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

191 q6 channel based flagging #412

Merged
merged 43 commits into from
Oct 25, 2024
Merged

191 q6 channel based flagging #412

merged 43 commits into from
Oct 25, 2024

Conversation

mpound
Copy link
Collaborator

@mpound mpound commented Oct 22, 2024

No description provided.

@mpound mpound linked an issue Oct 22, 2024 that may be closed by this pull request
@mpound mpound marked this pull request as draft October 22, 2024 18:21
@astrofle
Copy link
Collaborator

Flags are subject to Exception: You can only have one channel selection rule. Remove the old rule before creating a new one.. Which limits how flags can be used. Can we remove this for flags?

@mpound
Copy link
Collaborator Author

mpound commented Oct 23, 2024

yeah, that should be removed.

@mpound
Copy link
Collaborator Author

mpound commented Oct 23, 2024

also note read/write of flags is not yet implemented

@mpound
Copy link
Collaborator Author

mpound commented Oct 23, 2024

Somehow my description of this PR was never saved. It contains
Flag object, use of Flag object in GBTFITSLoad, applying flags to create data mask (saved in underlying SDF objects), passing of flags to calibration routines, creation of masks in output spectra, one proof of concept test.

@mpound mpound marked this pull request as ready for review October 24, 2024 03:21
@mpound mpound requested a review from astrofle October 24, 2024 03:21
@mpound
Copy link
Collaborator Author

mpound commented Oct 24, 2024

I'm going to see if there is an easy patch for SpecPlot, but that should not hold up the review. Thanks.

@mpound
Copy link
Collaborator Author

mpound commented Oct 24, 2024

Specplot should now not plot masked values.

from dysh.spectra.spectrum import Spectrum
f = Spectrum.fake_spectrum()
f.plot()
f.mask[1:100] = True
f.plot()

@mpound
Copy link
Collaborator Author

mpound commented Oct 24, 2024

Updates to Spectrum.smooth and spectra.core.smooth to deal with masked data correctly.

the general idea is correct but getps with smoothref needs working out.
@mpound
Copy link
Collaborator Author

mpound commented Oct 24, 2024

had to undo changes to smooth because it breaks getps with smoothref.

@mpound
Copy link
Collaborator Author

mpound commented Oct 24, 2024

See #415 for discussion of smoothing with masks

@astrofle
Copy link
Collaborator

astropy log messages are showing up now. Not sure why this is happening, since I did not set up a logger at all.

from pathlib import Path
from dysh.util.download import from_url
from dysh.fits.gbtfitsload import GBTFITSLoad
url = "http://www.gb.nrao.edu/dysh/example_data/mixed-fs-ps/data/TGBT24B_613_04.raw.vegas.trim.fits"
savepath = Path.cwd() / "data"
filename = from_url(url, savepath)
sdf = GBTFITSLoad(filename)
sdf.flags.clear()
sdf.flag(channel=[[100,10000]])
ps_sb = sdf.getps(scan=35, sig="T", apply_flags=True)#.timeaverage()
ps_sig = ps_sb.timeaverage()
    INFO: overwriting Masked Quantity's current mask with specified mask. [astropy.nddata.nddata]
    INFO: overwriting Masked Quantity's current mask with specified mask. [astropy.nddata.nddata]

@mpound
Copy link
Collaborator Author

mpound commented Oct 25, 2024

Those are coming from the used of Masked. I haven't yet looked into turning them off, kind of annoying.

…d-flagging-PS-rev

191 q6 channel based flagging ps rev
src/dysh/fits/sdfitsload.py Outdated Show resolved Hide resolved
src/dysh/spectra/spectrum.py Outdated Show resolved Hide resolved
src/dysh/spectra/spectrum.py Outdated Show resolved Hide resolved
src/dysh/spectra/spectrum.py Outdated Show resolved Hide resolved
@mpound mpound merged commit 97567ff into main Oct 25, 2024
11 checks passed
@mpound mpound deleted the 191-q6-channel-based-flagging branch October 25, 2024 21:02
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.

Selection by obstype and subobsmode does not work Q6 - Channel based flagging.
2 participants