Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tlist() should return list #186

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

samlaihei
Copy link

Method comments suggest that tlist() should return list. If the observation has only one scan, or if all scans have the same shape, np.array(datalist, dtype=object) can produce a bug, i.e. when you run the add_all() method, because the tlist can't be indexed by the array attribute.

@wumpus
Copy link
Contributor

wumpus commented Jun 24, 2024

Can you make a trivial example that shows the bad thing happening?

@achael
Copy link
Owner

achael commented Jun 24, 2024

Thanks, Greg, and sorry for the delay on this!

I just tried manually overwriting the scan_table and using the scan_gather=True option in obs.tlist(), and the current code returned a tlist of length 1, but indeed obs.tlist()[0] was not of the right datatype.

I agree reverting to a list for the output of obs.tlist() would fix this issue, but I think the output of obs.tlist() has to be an array for eh.self_cal() function to work. I will check this and try to find a solution.

In any case, thank you for pointing this out and I will try to fix it asap!

@samlaihei
Copy link
Author

samlaihei commented Jun 24, 2024

I created a new python environment with python==3.9, then did "pip install ehtim". Afterwards, assuming I've got the "EHT2017.txt" array file, run

import ehtim as eh

empty = eh.image.make_empty(64, 0.1, 12.51372778, 12.3911222)
arr = eh.array.load_txt('EHT2017.txt')

tint_sec = 10 # integration time in seconds
tadv_sec = 48*60 # advance time between scans in seconds
tstart_hr = 4.75 # UST time of the start of the observation
tstop_hr = 5.6 # UST time of the end of the observation
bw_hz = 8e9 # bandwidth in Hz

mjd = 57848

obs = empty.observe(arr, tint_sec, tadv_sec, tstart_hr, tstop_hr, bw_hz, mjd = mjd, timetype='UTC', ttype='direct')
print(obs.tlist())
obs.add_all()

Error at obs.add_all() and observing obs.tlist(), the recarray has lost its column attributes. So indexing by the attribute fails. I note that this particular issue doesn't appear if I run inside a clone of the eht-imaging GitHub repository.

Result/traceback from the above:

Warning: No NFFT installed!
Warning: scikit-image not installed! Cannot use hough transform
Warning: networkx not installed! Cannot use image_agreements()
Welcome to eht-imaging! v 1.2.8 

Generating empty observation file . . . 
Producing clean visibilities from image with direct FT . . . 
Adding gain + phase errors to data and applying a priori calibration . . . 
Adding thermal noise to data . . . 
[[(4.75, 10.0, 'ALMA', 'APEX', 0.1, 0.1, 209553.5182393453, -1599451.2601223036, (-0.0010685765032701037-0.000984149471301504j), (2.1019049091474612e-05+0.0013629132798366075j), (-0.0017099352902146699+0.0013150692734017334j), (-0.0027115074447248036+0.00039294372905035663j), 0.0011274508427832064, 0.0011274508427832064, 0.0011274508427832064, 0.0011274508427832064)
  (4.75, 10.0, 'ALMA', 'JCMT', 0.1, 0.1, 5253786856.579528, -4224118547.431905, (0.000850255907895284+0.0002924355917128896j), (-0.0021785621045085192-0.000618887239917807j), (-0.0008167494764875833+0.0014442656624165117j), (0.0029331705185673897-0.0006814439720133483j), 0.0014761796655416567, 0.0014761796655416567, 0.0014761796655416567, 0.0014761796655416567)
  (4.75, 10.0, 'ALMA', 'LMT', 0.1, 0.1, 2333016946.5312133, -3426533449.233782, (0.0001545664051225533+0.0004141718109630978j), (-0.00038201242348962156-3.042217563955738e-05j), (0.0013684408215413344+0.0007714307963192202j), (-0.00015091233905416564+0.00013585254112269936j), 0.0004668089978737211, 0.0004668089978737211, 0.0004668089978737211, 0.0004668089978737211)
  (4.75, 10.0, 'ALMA', 'PV', 0.1, 0.1, -3014205426.5130916, -5446553955.715623, (-0.00019048963699708007-0.0008572108885372759j), (-0.0003624532234719524-0.0006637152991819591j), (0.0002424961182792761+0.0015237584686408833j), (-0.0003952154782954445-9.203431300034841e-05j), 0.000713062522614269, 0.000713062522614269, 0.000713062522614269, 0.000713062522614269)
  (4.75, 10.0, 'ALMA', 'SMA', 0.1, 0.1, 5253765749.192307, -4224061246.7034817, (-0.002461905748070743+0.00035535514194030105j), (-0.0001332559896247996+0.0012342835918064884j), (0.0010179162530671868+0.00018597682892489893j), (-0.0015895383701354556+0.00010852509364660968j), 0.00133401782748567, 0.00133401782748567, 0.00133401782748567, 0.00133401782748567)
  (4.75, 10.0, 'ALMA', 'SMT', 0.1, 0.1, 2967780751.4956427, -4637612493.232811, (0.0002807741885107772+0.0006839897420126192j), (0.0008374044537749551+0.00039234995297552337j), (0.002722326943215992-0.0012928058949520393j), (0.002232942754924215-2.1410755478864478e-05j), 0.0013475615029126618, 0.0013475615029126618, 0.0013475615029126618, 0.0013475615029126618)
  (4.75, 10.0, 'APEX', 'JCMT', 0.1, 0.1, 5253577303.061289, -4222519096.171782, (0.006776002647869822-0.005746618451297441j), (0.00013790615168008007-0.013454592290146252j), (0.00916895863553124+0.006497874212364256j), (-0.0030484503357282203-0.0048348805757824865j), 0.00920559758296571, 0.00920559758296571, 0.00920559758296571, 0.00920559758296571)
  (4.75, 10.0, 'APEX', 'SMA', 0.1, 0.1, 5253556195.674068, -4222461795.443359, (0.004534158225656055+0.008990843043061443j), (-0.015134499391466454-0.014595844303976264j), (0.012650230090754583-0.008321159636327605j), (-0.005804171644159568-0.006786261571183399j), 0.008319062763833138, 0.008319062763833138, 0.008319062763833138, 0.008319062763833138)
  (4.75, 10.0, 'APEX', 'SMT', 0.1, 0.1, 2967571197.9774036, -4636013041.97269, (-0.004146735946688394-0.014338021070252125j), (0.006691944597349346-0.0018089900780704068j), (-0.0014529446414781166-0.005508791020943086j), (-0.004887959071699768+0.007768022278057411j), 0.008403522419175592, 0.008403522419175592, 0.008403522419175592, 0.008403522419175592)
  (4.75, 10.0, 'LMT', 'APEX', 0.1, 0.1, -2332807393.012974, 3424933997.9736595, (-0.003938834888045494-0.004052218346396079j), (0.0007075608025166339-0.0015329353918617672j), (-0.0013967033838580487-0.00035927613706752227j), (0.00021021998021075+0.006174217787625203j), 0.0029110655585112494, 0.0029110655585112494, 0.0029110655585112494, 0.0029110655585112494)
  (4.75, 10.0, 'LMT', 'JCMT', 0.1, 0.1, 2920769910.0483146, -797585098.1981227, (-0.0021828262302160052+0.0051329610322875556j), (0.0009292861399333581-0.0054668707489605095j), (-0.002064711913873629+0.008008779017690188j), (0.008283850437677551-0.0005546387557317021j), 0.003811479507101914, 0.003811479507101914, 0.003811479507101914, 0.003811479507101914)
  (4.75, 10.0, 'LMT', 'PV', 0.1, 0.1, -5347222373.044305, -2020020506.4818408, (6.052917762745027e-05+0.0012687390859251971j), (0.0016366905422716424+0.000850880834557528j), (-0.002114791307463094-0.0003065767948945636j), (0.002014205142540085+0.0020835354950303735j), 0.001841119516593142, 0.001841119516593142, 0.001841119516593142, 0.001841119516593142)
  (4.75, 10.0, 'LMT', 'SMA', 0.1, 0.1, 2920748802.661094, -797527797.4696994, (0.00043673259292137596-0.0016901111170784483j), (-0.0032712191257613086-0.0032369099999911364j), (0.0036077700039914406-0.002146484429578764j), (-0.0009739180836468196+0.003750906880795834j), 0.003444419219597199, 0.003444419219597199, 0.003444419219597199, 0.003444419219597199)
  (4.75, 10.0, 'LMT', 'SMT', 0.1, 0.1, 634763804.9644295, -1211079043.9990292, (-0.0017460924986175497-0.003359322497222428j), (0.0025894987154186644-0.00034597398936581764j), (0.006075057110152357-6.732870913069547e-05j), (0.002996115789865631+0.00020009764454171817j), 0.003479388839180651, 0.003479388839180651, 0.003479388839180651, 0.003479388839180651)
  (4.75, 10.0, 'PV', 'APEX', 0.1, 0.1, 3014414980.0313306, 5444954504.455501, (0.006842385874331752-0.0029816924122011736j), (0.0016713448365822685+0.004328330161922229j), (-0.004424237049026622+0.006031022377695105j), (0.004731092991524584-0.003984289156117049j), 0.004446726091618901, 0.004446726091618901, 0.004446726091618901, 0.004446726091618901)
  (4.75, 10.0, 'PV', 'JCMT', 0.1, 0.1, 8267992283.092619, 1222435408.283718, (0.0029711143658617606+0.004539864203598315j), (0.004427576899566395+0.004013448674981866j), (0.0019436430950221578+0.0044408211494575195j), (0.00026961490290122156+0.004834228132798279j), 0.005822131117022499, 0.005822131117022499, 0.005822131117022499, 0.005822131117022499)
  (4.75, 10.0, 'PV', 'SMA', 0.1, 0.1, 8267971175.705399, 1222492709.0121415, (-0.0007049159271367008+0.004843469267448655j), (-0.0008099942776905459-0.0072453053622683825j), (0.0001295976926656354-0.006616691643138459j), (0.008165119446215433-0.0009215666775993082j), 0.005261437266321629, 0.005261437266321629, 0.005261437266321629, 0.005261437266321629)
  (4.75, 10.0, 'PV', 'SMT', 0.1, 0.1, 5981986178.008734, 808941462.4828116, (0.0017349375070303595+0.002552403221293224j), (-0.0002214974848639636+0.004957241505235508j), (-0.00809591025423386+0.004982283374275828j), (0.0009432704724630677+0.0010427416699137302j), 0.005314854242576621, 0.005314854242576621, 0.005314854242576621, 0.005314854242576621)
  (4.75, 10.0, 'SMA', 'JCMT', 0.1, 0.1, 21107.387220261317, -57300.72842330146, (-0.012227276996166554+0.007125763988650769j), (-0.00023348675336220805+0.0002689293573021566j), (-0.004080803054638167+0.00308936073399706j), (0.010388760549074118-0.006193232090692977j), 0.010892209950386826, 0.010892209950386826, 0.010892209950386826, 0.010892209950386826)
  (4.75, 10.0, 'SMA', 'SMT', 0.1, 0.1, -2285984997.6966643, -413551246.5293297, (0.007600516547932461-0.007963484522557672j), (0.0021853026404577507+0.005876427714707242j), (0.01561992820072225-0.006834115971981903j), (-0.016755287104172307+0.0016089216462327938j), 0.009943181818181818, 0.009943181818181818, 0.009943181818181818, 0.009943181818181818)
  (4.75, 10.0, 'SMT', 'JCMT', 0.1, 0.1, 2286006105.0838847, 413493945.80090654, (-0.018352962284149402+0.006571581803650879j), (-0.017537397669382664-0.0011426357243207734j), (0.004869458451723752+0.021977888808005393j), (0.0026513722868011192-0.009902607214761527j), 0.011002793597180162, 0.011002793597180162, 0.011002793597180162, 0.011002793597180162)]
 [(5.55, 10.0, 'ALMA', 'APEX', 0.1, 0.1, 27852.374092776037, -1594082.1141887063, (0.00020646388517289434-0.0022991086418022734j), (-0.0007524465054288223+0.0018510145009330695j), (-0.0002158713754074504-0.00036551717365944j), (-0.0008683306175869869-0.002041243622134728j), 0.0011274508427832064, 0.0011274508427832064, 0.0011274508427832064, 0.0011274508427832064)
  (5.55, 10.0, 'ALMA', 'JCMT', 0.1, 0.1, 5869895876.450146, -3972546544.199735, (-0.001382517887485602-0.002011462413887057j), (-0.001399006015842932+0.0007947325365996437j), (0.0010818549768153221-0.0035811989160546044j), (-0.0006846277701846517-0.0011275904772962368j), 0.0014761796655416567, 0.0014761796655416567, 0.0014761796655416567, 0.0014761796655416567)
  (5.55, 10.0, 'ALMA', 'LMT', 0.1, 0.1, 2302040832.889363, -3321707484.789172, (-0.0008022515022880274-0.0007241687615745952j), (0.00024362684432995888-1.2344541129745138e-05j), (-0.0002713933400389125-0.000431967635242697j), (0.0003841605857306264+7.112069250783918e-05j), 0.0004668089978737211, 0.0004668089978737211, 0.0004668089978737211, 0.0004668089978737211)
  (5.55, 10.0, 'ALMA', 'PV', 0.1, 0.1, -2247723991.9195037, -5565557181.21492, (0.0007913871355802255+8.899443725656292e-05j), (-0.0011961396765068969-0.0003738372499938531j), (-0.0006294769528806647+0.001063815369828923j), (-0.00023276665495730486+0.0006889677676929025j), 0.000713062522614269, 0.000713062522614269, 0.000713062522614269, 0.000713062522614269)
  (5.55, 10.0, 'ALMA', 'SMA', 0.1, 0.1, 5869850306.850584, -3972490751.4308195, (0.0007827777215952786-0.0004401586957908813j), (0.00019930379602257648+0.001185255513085911j), (-0.0009883109217455888-0.0015779670923552504j), (-0.001020974198337205+0.001236717993575324j), 0.00133401782748567, 0.00133401782748567, 0.00133401782748567, 0.00133401782748567)
  (5.55, 10.0, 'ALMA', 'SMT', 0.1, 0.1, 3106044446.34886, -4500247520.77035, (-0.0006841205461342844+0.0014655208440236822j), (0.001398117879589285+0.000704004941769195j), (0.0002607669751508748+0.0006363159082651629j), (0.00040438730443607024-0.0006785495282841613j), 0.0013475615029126618, 0.0013475615029126618, 0.0013475615029126618, 0.0013475615029126618)
  (5.55, 10.0, 'APEX', 'JCMT', 0.1, 0.1, 5869868024.076053, -3970952462.085546, (-0.00597068991123853-0.004168212391714717j), (-0.013940193442914129+0.004046053495748074j), (0.008570713072299289-0.004006129175315319j), (0.0002486404384881913-0.013540679287092289j), 0.00920559758296571, 0.00920559758296571, 0.00920559758296571, 0.00920559758296571)
  (5.55, 10.0, 'APEX', 'SMA', 0.1, 0.1, 5869822454.476491, -3970896669.3166304, (0.008816151944676302+0.0007684315234076488j), (0.0047517547794306905+0.006680620905067094j), (0.004317740608960636+0.0017921221045477474j), (-0.0007923357451927369-0.0038684319037785766j), 0.008319062763833138, 0.008319062763833138, 0.008319062763833138, 0.008319062763833138)
  (5.55, 10.0, 'APEX', 'SMT', 0.1, 0.1, 3106016593.974767, -4498653438.656162, (0.00947821010144464-0.011535641694714709j), (-0.003697941179754925-0.00023890473351983535j), (-0.021050573459415918+0.005186044551924258j), (0.003081487831274289+0.0018829387437646905j), 0.008403522419175592, 0.008403522419175592, 0.008403522419175592, 0.008403522419175592)
  (5.55, 10.0, 'LMT', 'APEX', 0.1, 0.1, -2302012980.51527, 3320113402.6749835, (-0.0020046640639041166-0.0033747241356282395j), (-0.0007700531605237733+0.0018296004207354294j), (-0.00038299835145274956-0.0019789666980947348j), (-0.00017932621794110995+0.002405813036804297j), 0.0029110655585112494, 0.0029110655585112494, 0.0029110655585112494, 0.0029110655585112494)
  (5.55, 10.0, 'LMT', 'JCMT', 0.1, 0.1, 3567855043.560783, -650839059.4105628, (-0.00044975471713368096+0.0033869825356409515j), (0.006639093420189866+0.001664498174808378j), (-0.0015736898910810892+0.0037835526999231385j), (-0.005612623952988036+0.0045707706720211445j), 0.003811479507101914, 0.003811479507101914, 0.003811479507101914, 0.003811479507101914)
  (5.55, 10.0, 'LMT', 'PV', 0.1, 0.1, -4549764824.808866, -2243849696.4257483, (0.0006134579385807673+0.0014176374889542987j), (-0.000486996642780277-0.002255996600611767j), (0.0016522139599127455+0.0023222052368049614j), (0.00011063286373076776+0.0018573347010817436j), 0.001841119516593142, 0.001841119516593142, 0.001841119516593142, 0.001841119516593142)
  (5.55, 10.0, 'LMT', 'SMA', 0.1, 0.1, 3567809473.961221, -650783266.6416469, (0.004313927349686682-0.0013462183943766665j), (-0.0006389484858319467-0.0034084356120196034j), (-0.00023100297040095985+0.005464299171047695j), (0.002889351454431761+0.008210001699980238j), 0.003444419219597199, 0.003444419219597199, 0.003444419219597199, 0.003444419219597199)
  (5.55, 10.0, 'LMT', 'SMT', 0.1, 0.1, 804003613.459497, -1178540035.981178, (0.00045085522632038925-0.0013948836152972025j), (0.0009552782166897301+0.004813080691696974j), (-0.0032301747496465165-0.0029794817121522915j), (-0.0040071450279309355+0.00019557296566751143j), 0.003479388839180651, 0.003479388839180651, 0.003479388839180651, 0.003479388839180651)
  (5.55, 10.0, 'PV', 'APEX', 0.1, 0.1, 2247751844.2935963, 5563963099.100732, (-0.0022722592882151085+0.009792551435315919j), (-0.0007803850359908857-0.0016009496386023136j), (0.0005356986890936328-0.00010557498672661294j), (-0.005865248810108513-0.0040648576181945536j), 0.004446726091618901, 0.004446726091618901, 0.004446726091618901, 0.004446726091618901)
  (5.55, 10.0, 'PV', 'JCMT', 0.1, 0.1, 8117619868.36965, 1593010637.0151856, (-0.0013778425499685939+0.009257239933181354j), (0.0018589847390236224+0.001925470266323993j), (-0.0026511297234353844-0.004065255702498103j), (0.002973338278663555-0.001963561055311196j), 0.005822131117022499, 0.005822131117022499, 0.005822131117022499, 0.005822131117022499)
  (5.55, 10.0, 'PV', 'SMA', 0.1, 0.1, 8117574298.770088, 1593066429.7841012, (0.012092036132046843+0.013791883074685273j), (0.008159886739854494-0.009853061970883804j), (0.007154475518311832-0.007134407549438662j), (-0.0018267003773788006-0.007811506318898564j), 0.005261437266321629, 0.005261437266321629, 0.005261437266321629, 0.005261437266321629)
  (5.55, 10.0, 'PV', 'SMT', 0.1, 0.1, 5353768438.268364, 1065309660.44457, (-0.002431501663158241+0.006463179809432939j), (0.013876750165149951-0.004975816995679668j), (0.0033169118685588673-0.0030038751561980034j), (-0.004200118986980754-0.0008545609940850053j), 0.005314854242576621, 0.005314854242576621, 0.005314854242576621, 0.005314854242576621)
  (5.55, 10.0, 'SMA', 'JCMT', 0.1, 0.1, 45569.59956169431, -55792.76891588016, (0.002079435153612209-0.008492866060989238j), (-6.569114206635142e-05-0.007923029613130777j), (0.004401497709963886-0.009783611582709698j), (0.012493953430333113-0.012644938163138063j), 0.010892209950386826, 0.010892209950386826, 0.010892209950386826, 0.010892209950386826)
  (5.55, 10.0, 'SMA', 'SMT', 0.1, 0.1, -2763805860.501724, -527756769.3395313, (0.006872292872970837+0.006688513327771896j), (-0.0007541560883962797+0.0021656466497106913j), (0.011139089818265125+0.0097404981104722j), (-0.013006583479043174-0.00604599539661925j), 0.009943181818181818, 0.009943181818181818, 0.009943181818181818, 0.009943181818181818)
  (5.55, 10.0, 'SMT', 'JCMT', 0.1, 0.1, 2763851430.1012855, 527700976.5706154, (-0.011576693430287877-0.008874473101814249j), (-0.005505556857101334-0.011019871953324219j), (0.009246504468683693+0.02172173343435277j), (-0.0015831500896074876-0.0032951878666413166j), 0.011002793597180162, 0.011002793597180162, 0.011002793597180162, 0.011002793597180162)]]
Updated self.amp: no averaging
Updated self.amp: avg_time 0.000000 s

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], [line 16](vscode-notebook-cell:?execution_count=1&line=16)
     [14](vscode-notebook-cell:?execution_count=1&line=14) obs = empty.observe(arr, tint_sec, tadv_sec, tstart_hr, tstop_hr, bw_hz, mjd = mjd, timetype='UTC', ttype='direct')
     [15](vscode-notebook-cell:?execution_count=1&line=15) print(obs.tlist())
---> [16](vscode-notebook-cell:?execution_count=1&line=16) obs.add_all()

File ~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1613, in Obsdata.add_all(self, avg_time, return_type, count, debias, snrcut, err_type, num_samples, round_s)
   [1596]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1596) """Adds tables of all all averaged derived quantities
   [1597]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1597)    self.amp,self.bispec,self.cphase,self.camp,self.logcamp
   [1598]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1598) 
   (...)
   [1609]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1609) 
   [1610]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1610) """
   [1612]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1612) self.add_amp(return_type=return_type, avg_time=avg_time, debias=debias, err_type=err_type)
-> [1613]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1613) self.add_bispec(return_type=return_type, count=count,
   [1614]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1614)                 avg_time=avg_time, snrcut=snrcut, err_type=err_type,
   [1615]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1615)                 num_samples=num_samples, round_s=round_s)
   [1616]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1616) self.add_cphase(return_type=return_type, count=count,
   [1617]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1617)                 avg_time=avg_time, snrcut=snrcut, err_type=err_type,
   [1618]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1618)                 num_samples=num_samples, round_s=round_s)
   [1619]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1619) self.add_cphase_diag(return_type=return_type, count='min',
   [1620]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1620)                      avg_time=avg_time, snrcut=snrcut, err_type=err_type,
   [1621]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1621)                      num_samples=num_samples, round_s=round_s)

File ~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1382, in Obsdata.add_bispec(self, avg_time, return_type, count, snrcut, err_type, num_samples, round_s, uv_min)
   [1379]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1379)     cdf = ehdf.average_bispectra(cdf, avg_time, return_type=return_type,
   [1380]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1380)                                  num_samples=num_samples, snrcut=snrcut)
   [1381]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1381) else:
-> [1382]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1382)     cdf = ehdf.make_bsp_df(self, mode='all', round_s=round_s, count=count,
   [1383]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1383)                            snrcut=snrcut, uv_min=uv_min)
   [1384]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1384)     print("Updated self.bispec: no averaging")
   [1385]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:1385)     if return_type == 'rec':

File ~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:592, in make_bsp_df(obs, band, polarization, mode, count, round_s, snrcut, uv_min)
    [580]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:580) def make_bsp_df(obs,band='unknown',polarization='unknown',mode='all',count='min',round_s=0.1,snrcut=0., uv_min=False):
    [582]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:582)     """generate DataFrame of bispectra
    [583]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:583) 
    [584]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:584)     Args: 
   (...)
    [589]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:589)         df: bispectra data in DataFrame format
    [590]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:590)     """
--> [592]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:592)     data = obs.bispectra(mode=mode,count=count,snrcut=snrcut,uv_min=uv_min)
    [593]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:593)     sour=obs.source
    [594]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/statistics/dataframes.py:594)     df = pd.DataFrame(data=data).copy()

File ~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2804, in Obsdata.bispectra(self, vtype, mode, count, timetype, uv_min, snrcut)
   [2796]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2796) for tdata in tlist:
   [2797]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2797) 
   [2798]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2798)     # sys.stdout.write('\rGetting bispectra:: type %s, count %s, scan %i/%i ' %
   [2799]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2799)     #                 (vtype, count, tt, len(tlist)))
   [2800]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2800)     # sys.stdout.flush()
   [2802]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2802)     tt += 1
-> [2804]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2804)     time = tdata[0]['time']
   [2805]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2805)     if timetype in ['GMST', 'gmst'] and self.timetype == 'UTC':
   [2806]~/miniconda3/envs/test/lib/python3.9/site-packages/ehtim/obsdata.py:2806)         time = obsh.utc_to_gmst(time, self.mjd)

TypeError: tuple indices must be integers or slices, not str

…elds

This commit adds the 'w' coordinate to the polarization data structures and observation fields in the `const_def.py` file. The 'w' coordinate represents the third dimension in the UVW coordinate system. This addition allows for the representation of three-dimensional data in polarization calculations.

Additionally, the `recompute_uv` method in the `Obsdata` class in the `obsdata.py` file has been modified to include the 'w' coordinate when recomputing the u,v points using observation times and metadata. The modification allows for the computation of three-dimensional u,v,w coordinates for an array at a given time for a source at a given ra, dec, and rf.

The `compute_uv_coordinates` function in the `obs_helpers.py` file has also been updated to include the 'w' coordinate in the computation of u,v,w coordinates for an array at a given time for a source at a given ra, dec, and rf.

Lastly, the `make_uvpoints` function in the `obs_simulate.py` file has been modified to include the 'w' coordinate in the generated UV points. This modification allows for the generation of three-dimensional UVW points for simulated observations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants