dirac-institute / kbmod

KBMOD (Kernel-Based Moving Object Detection)
BSD 2-Clause "Simplified" License
46 stars 14 forks source link

correct_parallax fails for small r #627

Open ColinOrionChandler opened 5 months ago

ColinOrionChandler commented 5 months ago

This is an issue for reflex-correction in Region Search, fakes analysis, and probably reproject. The problem distance cutoff could be higher, there just aren't any fakes between 2.1 au and 3.1 au and I haven't tried reflex-correcting to distances under 5 au yet (though I have in the past, and it failed then). I don't think we can simply ignore these fakes because they will still show up in the image data. Besides, this issue would also impact users trying to RS or reproject in this regime. A possible fakes-only workaround would be to supply the known geocentric distances to the new version of correct_parallax, but I haven't tested this in any way yet.

ColinOrionChandler commented 5 months ago

r doesn't have to be that small. Here's an example with an object at r=5 au:

coord=(251.29497121, -22.30754899), obstime=2019-06-04 04:28:11.845853, heliocentric_distance=5.0

ColinOrionChandler commented 5 months ago

If we can incorporate the bounds (see #629 ) then I think this issue will be resolved.

ColinOrionChandler commented 3 months ago

This was fixed previously, but with the new vectorized approach this is again a problem. A new kludge could be to send the failed items to the old fitter?

jeremykubica commented 3 weeks ago

I am unable to reproduce this.

Using:

sc = SkyCoord(ra=251.29497121, dec=-22.30754899, unit="deg")
icrs_time = Time("2019-06-04T04:28:11", format="isot", scale="utc")
with solar_system_ephemeris.set("de432s"):
    eq_loc = EarthLocation.of_site("ctio")

corrected_coord1_geo, geo_dist1_geo = correct_parallax(
    coord=sc,
    obstime=icrs_time,
    point_on_earth=eq_loc,
    heliocentric_distance=5.0,
)
print(corrected_coord1_geo)

I get:

<SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, AU)
    (251.30786205, -22.31255488, 4.99999992)>

I am probably missing a step you are doing. Can you provide the lines of code you are using to call?

ColinOrionChandler commented 3 weeks ago

This should have been resolved with the analytic (a.k.a., "Drew") approach, where a fork was added to catch distances under 2 au or something like that. You can make sure this is OK by using a guess distance of 0.5 au. To reiterate, we don't care about objects at that distance, but we have objects in our fakes catalog that are at that distance, and we need to know where they are in the pixels post-reprojection.

For the correct_parallax_vectoried version, try a guess distance of 0.5 au as well, and that should give odd results.

ColinOrionChandler commented 3 weeks ago

I just realized there's some confusing terminology throughout the history of this issue. Vectorized means the separate function Dino added; it has the word "vectorized" in the function name. The analytic solution, what is in correct_parallax now, is also a vector solution, but I'm calling that one the analytic solution.

jeremykubica commented 2 weeks ago

Interestingly, the minimizer based approach fails for a guess distance of 0.5au, but the vectorized one (specifically correct_parallax_geometrically_vectorized()) fails.