View Issue Details

IDProjectCategoryView StatusLast Update
0002917CCdcielGeneralpublic26-05-03 13:45
ReporterHan Assigned ToPatrick Chevalley  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0002917: Spectroscopy, focusing with single star. Remove the saturation check.
DescriptionThis night I have tested with Nicolàs the blackout of the ghost stars generated by the spectroscopy slit. This look promising but the major problem was that focusing on a single bright star results mostly in saturation and error "No star found". We had to reduce the exposure time to 0.001 seconds and gain from 300 to 3 to get it working. So extreme values. Focusing with 0.001 second exposure als introduces seeing effects.

Ignoring bright stars for multi star focusing is fine since there are always fainter stars. But for single star focusing, there is no alternative star. So I assume it is better to remove this saturation for single star focusing.
TagsNo tags attached.

Activities

Han

26-05-02 13:59

reporter   ~0009764

Attached an updated cu_fits.pas. I have made the following modifications:

GetHFD3, remove redundant variable autoCenter
GETHFD2: Set default of allow_saturation: boolean=true{was false}
Replaced variable "asymmetry" by variable "boxed" similar as GetHFD3.

The variable strict_saturation in pu_main already specifies strict_saturation:=false. (line 15545, 15558 guidefits.GetStarList(rx,ry,s,AutofocusMinSNR,false); {search stars in fits image}
which allow 5 saturated pixels but not more.

To be tested.
cu_fits 2026-05-02.zip (38,536 bytes)

Patrick Chevalley

26-05-02 15:01

administrator   ~0009765

Thank you Han to look at this problem.

I make the change to cu_fits, but to make the compilation to work I have to remove the autocenter parameter in all the GetHFD3 call in cu_autoguider_internal. Is it intended?

In GetHFD2 having strict_saturation and allow_saturation both default to true is contradictory. This make allow_saturation to be ignored.

Also the change to GetHFD2 break the image inspection, it now return much less star than before and select double star.
See the two screenshot
newgethfd2.png (49,235 bytes)   
newgethfd2.png (49,235 bytes)   
oldgethfd2.png (55,254 bytes)   
oldgethfd2.png (55,254 bytes)   

Han

26-05-02 15:23

reporter   ~0009766

The autocenter parameter is always true. So yes it can be removed in all calls to this procedure gethfd3.

>>In GetHFD2 having strict_saturation and allow_saturation both default to true is contradictory. This make allow_saturation to be ignored.
I had to make allow_saturation:=true to allow more then 5 pixel saturated.
The logic is:
  if strict_saturation then
     max_saturated:=0
  else begin
    if allow_saturation then
     max_saturated:=MaxInt
    else
     max_saturated:=5;
  end;

>>Also the change to GetHFD2 break the image inspection, it now return much less star than before and select double star.
That is a suprise to me. I will investigate.

Patrick Chevalley

26-05-02 16:02

administrator   ~0009767

Why changing the default for allow_saturation, is it not better to add the parameters where it is need for the autofocus?
In this case the autofocus gethfd2 must specify in the parameters strict_saturation=false and allow_saturation=true.

Han

26-05-02 16:08

reporter   ~0009768

I do not know at this moment. Saturation was introduced for accurate HFD/FWHM measurements and image inspection. I have doubt it is required for focussing. It is possible that autofocus will work well with saturated stars. If so then an option is not required.

Han

26-05-02 16:31

reporter   ~0009769

I misread your last message. Yes better to have all calls to specify what is required. Proably it is better to replace the two booleans strict_saturation and allow_saturation with the integer max_saturated. That simplifies the logic and even give more flexibility.

Patrick Chevalley

26-05-02 16:37

administrator   ~0009770

Yes this is a good idea to have directly the max_saturated parameter to replace the two boolean.

Han

26-05-02 18:05

reporter   ~0009771

Strange bug. I'm slowly getting a grip on it. Has something to do with centering. But found this in Tf_main.measureAtpos:

Line 17450:
 if (xx>s)and(xx<(fits.HeaderInfo.naxis1-s))and(yy>s)and(yy<(fits.HeaderInfo.naxis2-s)) then begin
   s:=Starwindow;
  fits.FindStarPos(xx,yy,s,xxc,yyc,rc,vmax,bg,bgdev);
   if vmax>0 then begin
    fits.GetHFD2(xxc,yyc,2*rc,xc,yc,bg,bgdev,hfd,fwhm,vmax,snr,flux);
     if (hfd>0)and(Undersampled or (hfd>0.7)) then begin

Changed it in this one with a fixed search window of 2x14, so not to wide:

 if (xx>s)and(xx<(fits.HeaderInfo.naxis1-s))and(yy>s)and(yy<(fits.HeaderInfo.naxis2-s)) then begin
   s:=Starwindow;
  // fits.FindStarPos(xx,yy,s,xxc,yyc,rc,vmax,bg,bgdev);
   if vmax>0 then begin
// fits.GetHFD2(xxc,yyc,2*rc,xc,yc,bg,bgdev,hfd,fwhm,vmax,snr,flux);
    fits.GetHFD2(xx,yy,14,xc,yc,bg,bgdev,hfd,fwhm,vmax,snr,flux);
     if (hfd>0)and(Undersampled or (hfd>0.7)) then begin

The orginal code behaves weird. Two times centering result that some stars can not be measured or below it only. variable s=60/2 is too wide to use with the mouse.

Han

26-05-02 18:20

reporter   ~0009772

Also saturation needs to be handeled. Setting the first search window smaller to something like 14 * 2 is sufficient:

   s:=Starwindow div 2;
   if (xx>s)and(xx<(fits.HeaderInfo.naxis1-s))and(yy>s)and(yy<(fits.HeaderInfo.naxis2-s)) then
   begin
/// s:=Starwindow;
   fits.FindStarPos(xx,yy,14,xxc,yyc,rc,vmax,bg,bgdev);
   if vmax>0 then begin
     fits.GetHFD2(xxc,yyc,2*rc,xc,yc,bg,bgdev,hfd,fwhm,vmax,snr,flux);
     if (hfd>0)and(Undersampled or (hfd>0.7)) then begin

Han

26-05-02 20:38

reporter   ~0009773

Ok, I found the cause of "less star found" by the inspector. It is in Tf_main.measureimage:

 s:=28;// Fixed measuring window since in tilted images the stars not have the same HFD.

This gives a very large search field of 2x28 equals 56 x 56 pixels. If two stars are within this field it does not find the faint star with the modified GetHFD2 because "boxed" works differently. I will set this values at 14. Boxed method works fine in ASTAP for at least 5 years and is the same as in getHFD3,

I will make some more modifications in pu_main.pas and cu_fits.pas. It will be ready in a day or so.

In some cases I think the next code can be done by gethfd2 only:
 
   finderfits.FindStarPos(xx,yy,s,xxc,yyc,rc,vmax,bg,bgdev);
   if vmax>0 then begin
     finderfits.GetHFD2(xxc,yyc,2*rc,xc,yc,bg,bgdev,hfd,fwhm,vmax,snr,flux);

Patrick Chevalley

26-05-02 21:17

administrator   ~0009774

I think all this large search area where put here to help with the Vcurve focus method that need to detect very defocused star near HFD 20 or more. At this time I liked to put the mouse over a HFD 25 star and have the program to give me the measurement.
With the removal of Vcurve in the next version we can probably make a lot of simplification here.
The important point is it can detect the stars in Nicolàs long focal guide image.

Han

26-05-02 21:29

reporter   ~0009775

Yes will test with Nicolas. For modifyfing the variables in getHFD2 call, I downloaded the source code this morning and I need to modify not only
cu_fits,
pu_main

but also

cu_autoguider_internal,
cu_camera,
fu_starprofile.

Does not interfere with your work?

Patrick Chevalley

26-05-02 21:40

administrator   ~0009776

I make two change today that affect the file cu_fits and pu_main:
https://github.com/pchev/ccdciel/commit/ec5c67bdebc3ed3dbe9f675705982158fb0cd3a6
and
https://github.com/pchev/ccdciel/commit/033130c7d3d2d4a285e93c7f76e8a930234e52a3

But this not modify gethfd* so for now this is easy to merge.

Now I can stop my change and let you work on that.
I have other thing to do with the translation and documentation before the next release.

Han

26-05-02 23:19

reporter   ~0009777

This night we tested succesfully focusing on star Arcturus (magn 0.2) using an exposure time of 0.01 or 0.005 seconds. But ghost stars (caused by the slit) need to be covered otherwise they are detected as well and spoiling the focussing. Ghost stars have a different focus position. I will raise an other issue for that. I have already code for this covering/blackout of ghost stars.

Han

26-05-03 11:57

reporter   ~0009778

I'm ready with the code. See attached.

1) I have replaced the two booleans in the call to GETHFD2 by an integer called max_saturated. The option for 5 saturated pixels was never used in the code.
2) I have merged GetHFD3 and GetHFD2 into a single GETHFD routine. The autocenter=true option if for guiding.The only other difference is that the Signal threshold 3 × sd for GetHFD3 and 3.5 × sd for GetHFD2 is now 3*sd and for Sumval 15 * sd and 12 * sd is now 12*sd.
3) At two places I removed FindStarPos and relied on getHFD only.

For me this issue can now be closed.
ccdciel v2026-05-03.zip (259,801 bytes)

Patrick Chevalley

26-05-03 13:45

administrator   ~0009781

Thank you Han,

This new version work very well for me and it is great to not have all this different detection method.
I merged your change and this is now in the master branch.

I close the issue.

Issue History

Date Modified Username Field Change
26-04-30 23:56 Han New Issue
26-05-02 13:59 Han Note Added: 0009764
26-05-02 13:59 Han File Added: cu_fits 2026-05-02.zip
26-05-02 15:01 Patrick Chevalley Note Added: 0009765
26-05-02 15:01 Patrick Chevalley File Added: newgethfd2.png
26-05-02 15:01 Patrick Chevalley File Added: oldgethfd2.png
26-05-02 15:23 Han Note Added: 0009766
26-05-02 16:02 Patrick Chevalley Note Added: 0009767
26-05-02 16:08 Han Note Added: 0009768
26-05-02 16:31 Han Note Added: 0009769
26-05-02 16:37 Patrick Chevalley Note Added: 0009770
26-05-02 18:05 Han Note Added: 0009771
26-05-02 18:20 Han Note Added: 0009772
26-05-02 20:38 Han Note Added: 0009773
26-05-02 21:17 Patrick Chevalley Note Added: 0009774
26-05-02 21:29 Han Note Added: 0009775
26-05-02 21:40 Patrick Chevalley Note Added: 0009776
26-05-02 23:19 Han Note Added: 0009777
26-05-03 11:57 Han Note Added: 0009778
26-05-03 11:57 Han File Added: ccdciel v2026-05-03.zip
26-05-03 13:45 Patrick Chevalley Assigned To => Patrick Chevalley
26-05-03 13:45 Patrick Chevalley Status new => resolved
26-05-03 13:45 Patrick Chevalley Resolution open => fixed
26-05-03 13:45 Patrick Chevalley Note Added: 0009781