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

418 read/write of flags in GBTFITSLoad #426

Merged
merged 31 commits into from
Nov 27, 2024

Conversation

mpound
Copy link
Collaborator

@mpound mpound commented Nov 6, 2024

This PR adds

  • reading of GBTIDL flag files and creation of Flags object (sdf.flags) and data mask therefrom (sdf._sdf[i]._flagmask[k])
  • the GBTFITSLoad constructor has a skipflags=T/F to control reading of GBTIDL flags files [default: False]
  • Writing of flags to SDFITS via GBTFITSLoad.write(flags=True). flags=True is the default. A new column "FLAGS" with type unsigned int (1 or 0) and shape identical to the "DATA" column is added to the binary table HDU.
  • new tests of FLAGS read/write and updates of old tests where necessary. Tests include both multifile=True and False and flags=True and False.

This PR does NOT add:

  • writing of flags from Scans for SDFITS output
  • writing of flags directly from SDFITSLoad. Although there is a flags argument in SDFITSLoad.write, it is currently ignored. In our case the FLAGS column is added before write() is called, so we don't want to double-add it. We can think about how important it is to implement also in SDFITSLoad.

@mpound mpound linked an issue Nov 6, 2024 that may be closed by this pull request
@mpound mpound requested a review from astrofle November 6, 2024 22:49
@astrofle
Copy link
Collaborator

The reading of GBTIDL flags will fail if the flag was created after the fact through GBTIDL as it adds a space to the line, so the first character becomes ' *' rather than '*' (fixed adding v.strip()).

It is also possible to create flags that include ranges so the flag file could look like:

[header]
created = Fri Nov 22 19:04:55 2024                                                                                                                                                                               
version = 1.0                                                                                                                                                                                                    
created_by = gbtidl                                                                                                                                                                                              
[flags]
#RECNUM,SCAN,INTNUM,PLNUM,IFNUM,FDNUM,BCHAN,ECHAN,IDSTRING
 *|20|42:51|*|*|*|2299|*|unspecified

This also implies that the flag only contains a start channel (BCHAN) but no end channel, which is currently not supported by the reader.

@astrofle
Copy link
Collaborator

Not strictly related to this PR, but while trying to write a how-to guide I ran into these issues:
#429
#428
#427

mpound and others added 2 commits November 26, 2024 12:04
…github.com:GreenBankObservatory/dysh into 418-readwrite-of-flags-in-sdfits-scan-and-spectrum
Updates leftover description messages for how-to guides
@astrofle
Copy link
Collaborator

Thanks a lot for all the work!
The only outstanding issue flag related is #432 (that is documented).
Let me know how you'd like to proceed.

…github.com:GreenBankObservatory/dysh into 418-readwrite-of-flags-in-sdfits-scan-and-spectrum
@mpound
Copy link
Collaborator Author

mpound commented Nov 26, 2024

All three issues are now fixed. I identified one more during this testing. I will make an issue but it should not hold up this merge.

@mpound mpound merged commit 8e13069 into main Nov 27, 2024
11 checks passed
@mpound mpound deleted the 418-readwrite-of-flags-in-sdfits-scan-and-spectrum branch November 27, 2024 20:06
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.

Read/Write of flags in SDFITS, Scan, and Spectrum
2 participants