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
DM-23781: Improve Sky Object Placement #312
Conversation
1e21e3e
to
5a7d7d5
Compare
generator. This is a deterministic sequence that mimics a random trial and | ||
error approach whilst acting to minimize clustering of points for a given | ||
field of view. Up to `nTrialSources` points are generated, returning the | ||
first `nSources` that do not overlap with the mask. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE:
"acting to minimize clustering of points"
does this algorithm guarantee no overlapping positions? If not, you might consider adding:
# Add doubled-in-size sky object spanSet to the avoid mask.
avoid = avoid.union(spans.dilated(int(skySourceRadius)))
after the line:
skyFootprints.append(fp)
at line 93 below in order to have a cumulative avoid
mask. It worked nicely using the old trial 'n error algorithm (but may not be necessary now?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's nothing explicit in the SciPy Halton Sequence implementation that prevents overlapping positions as N tends to infinity, however, it is (by design) exceptionally unlikely.
However, I do like your additional logic to prevent this and I don't think it adds too much overhead. As SkyObjectsConfig
already has a growMask
field, I'm tempted to recommend using this information rather than hard-coding a double-in-size condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following testing, I think I convinced myself that I prefer your initial idea of growing the sky object footprints by their own radius. I experimented with growing the growMask
parameter, and while it works, it occurred to me that that parameter was intended to mask the flux in the wings of astrophysical sources. We want to grow sky object footprints for a different reason altogether (to avoid clustering for stats purposes). To that end, I've adopted your initial recommendation above as-is.
@@ -57,7 +57,7 @@ def setUp(self): | |||
|
|||
# Relative tolerance for tweak factor | |||
# Not sure why this isn't smaller; maybe due to use of Poisson instead of Gaussian noise? | |||
self.rtol = 0.1 | |||
self.rtol = 0.15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth a comment in the commit message about this change (not that we can really explain it at the moment...😞).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about adding one, but the initial in-line that's already there seems to capture everything I would want to say anyway. In the spirit of adding something, I've added this:
# It seems as if some sky objects are being placed in the extra
# background region, which is causing the offset between the expected
# factor and the measured factor to be larger than otherwise expected.
# This relative tolerance was increased from 0.1 to 0.15 on DM-23781 to
# account for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good (I did just mean adding something to the commit message, but this works too!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the commit message! For some reason I didn't parse that the first time around. Commit message also updated with some background too.
97d21ba
to
dc889c1
Compare
This commit switches sky object placement from pseudo-random to quasi-random positioning using the Halton Sequence. During testing, the dynamic detection task unit test returned failures for all tests which employ sky objects. This is believed to be an inherent weakness within the dynamic detection task highlighted by the changes made on this ticket, and not related to any of the changes made here. As a consequence, the relative tolerance for acceptance of those failing unit tests was increased from 0.1 to 0.15 in order to allow this ticket to pass at this time.
dc889c1
to
85310dc
Compare
No description provided.