GreenBankObservatory / dysh

https://dysh.readthedocs.io
Other
9 stars 3 forks source link

implement polarization averaging #294

Open mpound opened 2 months ago

mpound commented 2 months ago

Feature description We have not yet implemented polarization averaging and it is not included in the milestones. We have a placeholder for it in Scan and ScanBlock.

Additional context Ditto for the finalspectrum() method which is supposed to do both time and polarization averaging. This is left over from the pre-dysh design; we should revisit the design and make sure that's what we want.

teuben commented 3 weeks ago

In some coding I was reminded that the order of raw spectra in a multi-polarization could be confusing:

file2=dysh_data(example='getps')    # this is the larger example of getps
sdf2 = GBTFITSLoad(file2)

p2 = sdf2.getps(ifnum=0,plnum=[1,0])
sp2=p2[0].calibrated(0)  #0.88490229845047 

p2 = sdf2.getps(ifnum=0,plnum=[0,1])
sp2=p2[0].calibrated(0)  #0.88490229845047 

it is of course related to how the selection is done, the order of elements in plnum= does not mean in that order data are stored. Conversely in the resulting spectrum I cannot see what polarization it is (is that a bug?). The time is labeled though, so we can deduce the raw spectra a stored as [Ntime][Npol]

mpound commented 3 weeks ago

The order in the PSScan is whatever the order is in the data file, not the order of selection. While it might be nice if the order mirrored the selection, I don't think that is something we should spend time implementing now. RFE perhaps, but because we ultimately rely on pandas to do the down selection to a new DataFrame, I suspect it is more involved that one might initially think.

We should add PLNUM to the spectrum header. Basically the whole meta dict in make_spectrum needs to be more complete.

teuben commented 3 weeks ago

agreed, no need to re-shuffle (likely performance killer). there was another issue with notes on meta-data that needs updating, but adding the pol value would be a useful RFE