sot / find_attitude

Find the attitude of Chandra from ACA yag/zag positions (full-sky search)
https://sot.github.io/find_attitude
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Find attitude fails #19

Closed javierggt closed 2 years ago

javierggt commented 2 years ago

Find-attitude fails in a test by PCAD, while SAUSAGE manages to find an attitude.

taldcroft commented 2 years ago

It looks like the problem is in the web front end (both current production and the new version). Somehow the tolerance parameter is not being set to the user-supplied value. When I do this case "by hand" with a tolerance of 3.0 arcsec it finds an attitude solution:

In [1]: txt = """slot yag zag mag
   ...: 0     -768.95   -1747.60      7.0
   ...: 1     2145.03     162.55      7.1
   ...: 2    -1822.70     156.53      7.1
   ...: 3      797.70   -2078.80      7.1
   ...: 4     2078.75     -73.90      9.3
   ...: 5    -2050.45    -963.75      8.6
   ...: 6    -1922.23    -400.10      9.4
   ...: 7     -589.58    1532.65      6.7
   ...: """

In [2]: from find_attitude.find_attitude import *

In [4]: stars = get_stars_from_text(txt)

In [5]: solutions = find_attitude_solutions(stars, tolerance=3.0)
2022-07-26 18:29:37,977 Using AGASC pairs file /Users/aldcroft/ska/data/find_attitude/distances.h5
2022-07-26 18:29:37,986 Starting get_match_graph
2022-07-26 18:29:37,986 Getting matches from file
2022-07-26 18:29:39,307 Adding edges from 1105350 matching distance pairs
2022-07-26 18:29:48,407 Added total of 359426 nodes
2022-07-26 18:29:48,415 Getting all triangles from match graph
2022-07-26 18:29:50,677 Finding triangles that match stars pattern
2022-07-26 18:29:50,861 Checking clique [452728128, 452729840, 452731944, 452731232]
2022-07-26 18:29:50,861 
2022-07-26 18:29:50,865 Done with graph matching
Dataset               = 1
Method                = neldermead
Statistic             = chi2
Initial fit statistic = 1.98127e+07
Final fit statistic   = 5.50698 at function evaluation 259
Data points           = 8
Degrees of freedom    = 6
Probability [Q-value] = 0.480613
Reduced statistic     = 0.91783
Change in statistic   = 1.98127e+07
   yagzag.dra     -807.106    
   yagzag.ddec    2074.04     
Dataset               = 1
Method                = neldermead
Statistic             = chi2
Initial fit statistic = 5.50698
Final fit statistic   = 5.20658 at function evaluation 314
Data points           = 8
Degrees of freedom    = 5
Probability [Q-value] = 0.391193
Reduced statistic     = 1.04132
Change in statistic   = 0.300399
   yagzag.dra     -807.142    
   yagzag.ddec    2074.03     
   yagzag.droll   0.260508    
javierggt commented 2 years ago

Well, that's good, because it means I can fix it right away.

taldcroft commented 2 years ago

In https://github.com/sot/kadi-apps/blob/main/kadi_apps/blueprints/find_attitude/templates/find_attitude/index.html:

<form action="/find_attitude/" method="post">

  <div class="row">
    <div class="col">
      <label for="distance_tolerance">Distance tolerance (arcsec) </label>
      <input type="text" class="form-control" id="distance_tolerance" name="tolerance" value="{{distance_tolerance}}"> 
    </div>
  </div>

I think that it should be name="distance_tolerance" since the get asks for that and not tolerance.

I'm not sure what, if anything, the id tag is doing here.

javierggt commented 2 years ago

FIxed already.

taldcroft commented 2 years ago

Nice. I tried testing on web-kadi-test and it still fails. Is the fixed deployed on kadi-test?

javierggt commented 2 years ago

It is not on kadi-test because I know it is going to work, so I figured I could save myself an iteration. I tested it in my local development setup.

taldcroft commented 2 years ago

We definitely want to get this in to test for the flight promotion and give Eric a chance to re-do his failing test and sign off that it is passing now. I'm really excited that we found and can easily fix a bug like this now.

javierggt commented 2 years ago

I thought of merging this, modify web-kadi env file, install in kadi-test (with the patch release), then tell Eric, and so on.

If I install now on kadi-test, then I have to install again after I make the patch release, but I KNOW it is going to work.

javierggt commented 2 years ago

I installed the fix in kadi-test

taldcroft commented 2 years ago

And I have seen with my own eyes now that it does work, thanks! :tada: