View Issue Details

IDProjectCategoryView StatusLast Update
0002906CCdcielGeneralpublic26-04-08 10:28
Reporterhan Assigned ToPatrick Chevalley  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0002906: New improved pu_hyperbola.pas
DescriptionAttached an improved pu_hyperbola.pas. The older version worked fine but I was personal not so happy with the orginal brute force method of curve fitting. The following has changed:

1) The new version has a Nelder-Mead method of curve fitting. The fitting is tiny bit better then the old method for some difficult datasets. The processing speed went from from 30 to 50 ms to 30 microseconds on my desktop. So it is about 1000 times faster. If for focussing the routine is called 9 times then the total processing time goes from 0.3 seconds to 0.0003 seconds on my desktop. For a smaller RPI computer it will be more. Number of iterations are now reported at somewhere around 50. The old version reported maybe 5 iterations but that did not included the internal cycling which took maybe 60000 cycles total.

2) I have moved the global variables iteration_cycles, lowest_error to the procedure find_best_hyperbola_fit(). This resulted in some minor changes in fu_starprofile which was added. The orginal fu_starprofile.pas was downloaded yesterday.

3) The function mean_error_hyperbola() is made symmetrical.


The exiting format of “data: array of TDouble2 {pos, hfd}” looks a little weird since position are stored in [*,1] and HFD’s in [*,2] but I haven’t looked in detail. The positions are in steps rather then actual positions. This all has been kept original. Maybe this should be revisited but that is for next time.

The routine has been tested with several curves and fitting could be a tiny amount better then the old routine for difficult data sets. So the major gain seems processing speed.
TagsNo tags attached.

Activities

han

26-04-07 11:52

reporter  

Patrick Chevalley

26-04-07 14:46

administrator   ~0009709

Thank you Han.

I commit your change in https://github.com/pchev/ccdciel/commit/989bed519f50a6537d80e5999037c6f24b1715f7

I apply a change to your to cu_hyperbola.pas I make last november. To fix a memory leak on ARM processor it require the dynamic array parameter to be var, probably a fpc bug.
procedure find_best_hyperbola_fit(var data:array of TDouble2 ...

I tested with the simulator and it look good. I will make real test tonight.

Patrick Chevalley

26-04-08 10:28

administrator   ~0009711

The test with real star was without any issue, even with non-symmetric measurement.
So I close the report, thank you again to maintain this functions.

Issue History

Date Modified Username Field Change
26-04-07 11:52 han New Issue
26-04-07 11:52 han File Added: pu_hyperbola 2026-04-07.zip
26-04-07 14:46 Patrick Chevalley Note Added: 0009709
26-04-08 10:28 Patrick Chevalley Assigned To => Patrick Chevalley
26-04-08 10:28 Patrick Chevalley Status new => resolved
26-04-08 10:28 Patrick Chevalley Resolution open => fixed
26-04-08 10:28 Patrick Chevalley Note Added: 0009711