Closed sbailey closed 3 years ago
thanks for that. one comment: do we care that it s not "backward-compatible", ie that running that code e.g. won t reproduce the 1.0.0 catalogs? I think we don t care (ie if we want to reproduce the 1.0.0 catalogs, let s just use the 1.0.0 tag), but I m just raising the point, in case.
I think it's fine for this not to be backwards compatible. As Anand says, one can always use a tag for that purpose.
@sbailey: Sorry the glob()
s were a wild goose chase and that this was an errant set()
. I think it's fine to merge this if it's what you need to make progress. I've checked that I don't use this set()
construction when making the skies, which is the other main case where SUBPRIORITY
crops up. Thanks for fixing this!
Thanks for the quick reviews. Regarding backwards compatibility: we've already "broken" that in master by making the random seeds based on healpix (good) instead of the same for every healpix. But I think that is ok — we want fiberassign to be backwards compatible for replaying mocks, but for desitarget the most important thing is be be reproducible for how a particular version creates its outputs.
I will merge now so that I can rebase the subpriority branch for further testing.
one last sanity-check comment (sorry, after the merging): @sbailey did you verify that this change of adding np.unique() in the infiles definition in cuts.py only was sufficient to get it right for:
for secondary, it should be fine, as there is no healpix pixels at play, it s a loop over the individual target masks (which all have an associated fits file) : https://github.com/desihub/desitarget/blob/f2c6d4d2f4def25f6c79e1dfe235839640e73d9b/py/desitarget/secondary.py#L294-L295
@geordie666 : extra minor comment: while checking the code, I notice that there are some "hppixlist" in write_secondary() docstring and function, though not present in the argument list; likely some copy-pasting leftover from write_targets(): I guess the code doesn t crash on that "if hppixlist is not None", because the if conditions just above are not met when you generate the catalogs... https://github.com/desihub/desitarget/blob/f2c6d4d2f4def25f6c79e1dfe235839640e73d9b/py/desitarget/io.py#L906-L938
I just verified that the backup (=gaia) targets do not use glob(); the file searching is based on identifying healpix pixels, so perfect.
for secondary, it should be fine, as there is no healpix pixels at play, it s a loop over the individual target masks (which all have an associated fits file) :
@geordie666 : extra minor comment: while checking the code, I notice that there are some "hppixlist" in write_secondary() docstring and function, though not present in the argument list; likely some copy-pasting leftover from write_targets(): I guess the code doesn t crash on that "if hppixlist is not None", because the if conditions just above are not met when you generate the catalogs...
This has been fixed in #739. Thanks!
@geordie666 this fixes a bug originally found by @araichoor :
select_targets
was getting its input files in a random order, which resulted in the output targets having a random order. This was problematic because the SUBPRIORITY assigned to the targets was based upon their order in the file, thus breaking the TARGETID:SUBPRIORITY mapping from one run to the next.The update that actually fixed the problem was changing
to
i.e.
set
returns a random order of unique items, whilenp.unique
returns sorted unique items. I'm not sure if leaving thelist(...)
cast was necessary, but I was trying to keep the update as minimal as possible.Along the way, I also wrapped
sorted(glob(...))
everywhereglob
appeared, but that wasn't the core issue here and I didn't undo those.Reproducer: