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

Target selection for the first MWS Stream Program (GD1) #814

Merged
merged 65 commits into from
May 28, 2024

Conversation

geordie666
Copy link
Contributor

This PR adds code for the first MWS stream program (GD1). It builds on the work provided by @segasai's as part of Issue #812.

As a side-effort, this PR also updates any units that are written to files produced by desitarget to be FITS-compliant.

This is still work in progress, but the code to create the actual target files is in place.

Remaining work before merging this PR includes:

  • Incorporating the external dependency on gaia_zeropoint mentioned in Issue Y4 Y5 MWS program selection #812.
  • Determining how to merge the targets with the existing targets in the MTL ledgers.
  • Adding final priorities, and numbers of observations, for the GD1 targets (once they're determined).

Possible additional work might include:

  • Adding units for some of the new Gaia quantities that haven't previously been in the DESI data model.
  • Adding code to read the LS sweeps (and match to Gaia DR3) per-sweep rather than per-stream. This would be useful if we extend targeting to multiple stream programs in the future.

@segasai and/or @sazabi4. I posted this PR before completely finishing my implementation in the hope that you could check my working. Could you please:

  • Check that the cache in /global/cfs/cdirs/desi/target/catalogs/streamcache/gd1-dr9-cache.fits is in agreement with @segasai's database-derived cache.
    • In particular, that the Gaia quantities seem correctly matched to the Legacy Surveys sources.
  • Check that the targets in /pscratch/sd/a/adamyers/dr9/2.7.0.dev5481/streamtargets/main/resolve/bright/streamtargets-gd1-bright.fits seem reasonable. The different classes are stored as bit-masks in the SCND_TARGET column, with the following interpretations:
    • Bit-nameGD1_BRIGHT_PM, bit-number 2**55, "Bright targets with Gaia in GD1 stream"
    • Bit-name GD1_FAINT_NO_PM, bit-number 2**56, "Faint targets without Gaia in GD1 stream"
    • Bit-name GD1_FILLER, bit-number 2**57, "Filler targets in GD1 stream"
  • Try to determine whether we can make the cache smaller. Currently, the read_data() function provided with Issue Y4 Y5 MWS program selection #812 produces ~113M sources. This is manageable, but large.

@geordie666 geordie666 added the WIP Work in Progress; don't merge yet label Mar 5, 2024
@coveralls
Copy link

coveralls commented Mar 5, 2024

Coverage Status

coverage: 53.312% (-2.6%) from 55.87%
when pulling 6b7b7df on ADM-stream-MWS
into 9e3bcd1 on main.

bin/select_stream_targets Outdated Show resolved Hide resolved
py/desitarget/streams/cuts.py Outdated Show resolved Hide resolved
py/desitarget/streams/gaia_dr3_parallax_zero_point/zpt.py Outdated Show resolved Hide resolved
py/desitarget/streams/io.py Outdated Show resolved Hide resolved
@geordie666
Copy link
Contributor Author

@segasai: There's a new version of the target file here:

/pscratch/sd/a/adamyers/blat/dr9/2.7.0.dev5481/streamtargets/main/resolve/bright/streamtargets-gd1-bright.fits

It's very close, now, to your version:

  • The faint sample is identical.
  • The bright sample has on extra target in my list, which is one of the rounding-error/matching cases where an object is ~1.00 arcseconds from a Gaia object.
  • Your version of the filler sample has an extra 16 targets that are, I think, removed by the desitarget checks on target brightness.

Let me know if you think this is good enough to proceed.

@segasai
Copy link
Contributor

segasai commented May 7, 2024

Thank you @geordie666 ! I think those numbers look good enough for me!

@geordie666
Copy link
Contributor Author

geordie666 commented May 13, 2024

I think I've now finished the code for the end-to-end process of adding the GD1 stream targets. Previously I had:

  • Written a reasonable cache.
  • Written reasonable targeting files.

I've now also written code to add the new targets to the MTL ledgers. The overall process is as described in this thread on Slack. New targets are added to the secondary ledgers, and existing targets are merged with primary/secondary targets adopting the state of the highest-priority target.

An example of how adding the new targets would look after running on the current MTL ledgers is here:

/pscratch/sd/a/adamyers/mtlsandbox/mtl

And an example of "merging" a new and old target is:

grep 39627660212571777 /pscratch/sd/a/adamyers/mtlsandbox/mtl/main/bright/mtl-bright-hp-10232.ecsv | awk '{print $7, $8, $9, $10, $11, $15, $16, $24, $27}'

39627660212571777 2305843017803628544 0 1280 0.24369827786837128 0 2 MWS_MAIN_BLUE|UNOBS 1500
39627660212571777 6917529036231016448 0 1280 0.2004516496327986 36028797018963968 4 GD1_BRIGHT_PM|UNOBS 1520

where the printed columns are:

TARGETID DESI_TARGET BGS_TARGET MWS_TARGET SUBPRIORITY SCND_TARGET NUMOBS_MORE TARGET_STATE PRIORITY

I think I'm basically ready to merge and tag the code and process the new targets. Before I do that, though, we should finalize whether these are the correct priorities and numbers of observations for the GD1 stream targets:

https://github.com/desihub/desitarget/blob/ADM-stream-MWS/py/desitarget/data/targetmask.yaml#L420-L422
https://github.com/desihub/desitarget/blob/ADM-stream-MWS/py/desitarget/data/targetmask.yaml#L574-L576

@geordie666
Copy link
Contributor Author

This PR is now almost ready to merge. I'm waiting on exact priorities for the new target classes from the Milky Way Group, then I'll proceed.

@geordie666 geordie666 merged commit c77b037 into main May 28, 2024
10 of 12 checks passed
@geordie666 geordie666 deleted the ADM-stream-MWS branch May 28, 2024 21:07
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.

4 participants