GreenBankObservatory / dysh

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

Column/metadata updates after `getps` #213

Open astrofle opened 7 months ago

astrofle commented 7 months ago

getps does not update some of the metadata of the result after using timeaverage on the result.

Example:

from dysh.fits import GBTFITSLoad
sdf = GBTFITSLoad(file)
getps = sdf.getps(scan, plnum=0)
ps = getps.timeaverage()[0]
ps.meta["DURATION"] # Is that of a single integration.
ps.meta["TUNIT7"] # This one is still "Counts"

The following columns are not being updated:

The following columns are updated, but do not agree with GBTIDL:

The following columns were not found in dysh but are in GBTIDL:

The columns below are keywords in the header, not sure why GBTIDL makes them columns now

This one I don't think we care about

mpound commented 7 months ago

We should come to a general consensus about how metadata should be treated when averaging spectra.

mpound commented 6 months ago

General Principle

When averaging integrations or ScanMixin derivatives, the header values of the resultant Spectrum should contain averages of [most] numeric values in the individual integrations/Scans.

The exceptions are:

Primary Header Disposition

Primary header variables such as TELESCOP, SITELONG, etc could be made into columns in the SDFITS table, though since they are constant it is unlikely that anyone would want to use them for selection. It makes more sense to have an user-level accessor in SDFITSLoad for the primary header. Also the primary header values would be added to spectral metadata (averaged or not) in Spectrum.make_spectrum()

Miscellaneous

TUNIT7 can take on whatever the flux unit is of the spectrum, but perhaps is better to be replaced with the more conventional FITS keyword BUNIT.

It is unclear what the purpose of LASTON and LASTOFF are; the description simply says “LAST ON/OFF for position switching.’ We can update them I guess, but that info would also be in to-be-implemented command logging.

INT is integration number (intnum) which GBTIDL allows selection on. A series of rows in SDFITS that are all part of the same integration (e.g., cal on, cal on, pols, sig, ref) all share the same integration number. Peter and I discussed this yesterday in a different context and agreed intnum was important to keep as a concept. Likely implementation would be that it is created as an SDFITS column on GBTFITSLoad instantiation, e.g., everything with the same OBSDATE gets the same intnum. I consider this a separate issue.

astrofle commented 6 months ago

Split into EXPOSURE and DURATION as high priority, the rest medium priority.