View Issue Details

IDProjectCategoryView StatusLast Update
0002396SkyChart1-Softwarepublic21-01-01 11:08
Reporterhan Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionreopened 
Target Version4.4Fixed in Version4.3 beta 
Summary0002396: Minor tweaks for unit u_290.pas
DescriptionHello Patrick,

Some minor tweaks for unit u_290.pas. See attached.

Fixed:
1) Correct some comments in the descriptions.

Added:
2) Line 902. Added and extra condition to speed up about 0.2 ms so almost nothing:
           if sep<required_range+15*pi/180 then {center close enough to check the corners}

Added:
3: Added procedure reset290index; Calling this procedure replaces somewhere in your code area290:=290+1; I think this is a cleaner solution. The variable area290 can move from global to below implementation.


Not fixed.
4) If the celestial pole is in one of the corners some star are missing. See attached screenshot. This is caused by the filterin in line 1056
      ((searchmode='T') or ( (abs(delta_ra*cos_telescope_dec)<field_diameter/2) and (abs(dec2-telescope_dec)<field_diameter/2)) )

The problem is that cos_telescope_dec is for the center of the window and not the corner. I solved in my program by overriding the filtering for the areas near the pole. Something like

      ((searchmode='T') or ((field_diameter>4 degrees) and ((area290<=5) or (area290>=285))) or ( (abs(delta_ra*cos_telescope_dec)<field_diameter/2) and (abs(dec2-telescope_dec)<field_diameter/2)) )

An other solution is to remove all filtering in this line but then for my program the star plot will become slower since it tries to plot all stars retrieved.

Regards, Han
TagsNo tags attached.

Activities

han

20-12-30 18:33

reporter  

cdc.png (257,118 bytes)   
cdc.png (257,118 bytes)   
u_290.zip (11,111 bytes)

han

20-12-30 22:24

reporter   ~0006866

For 4) I experimented a little further. It is a compromise between speed and map coverage. Currently I'm at something like:

       ( (searchmode='T') or ((field_diameter>4 degrees) and ((area290=1) or (area290=290))) or (sqr( delta_ra*cos_telescope_dec) + sqr(dec2-telescope_dec)<sqr(field_diameter * factorX) ) ) {check on areas 1 and 290 fixes some coverage problems with celestial poles in the corner}

So only for the two pole areas 1 and 290. The main filtering is earlier done. Furthermore it works better for me if I calculate the distance by using the rule of Pythagoras. In my program I use a zoom factor rather field_diamater, so I can't test above condition. factorX should be little larger then one.

Han

Patrick Chevalley

20-12-31 10:06

administrator   ~0006867

Thank you Han,

I apply the change and for the filter I use:
( (searchmode='T') or ((field_diameter>4*pi/180) and ((area290=1) or (area290=290))) or (sqr( delta_ra*cos_telescope_dec) + sqr(dec2-telescope_dec)<sqr(field_diameter * 1.5) ) )
This look good.

https://github.com/pchev/skychart/commit/6cb1edfb6d55b00be7d663466ae57ac7b9353952

han

20-12-31 10:12

reporter   ~0006868

Good morning Patrick,

I'm still not fully happy with fix of problem 4). The basis of the code was written more then 20 years ago. It seems no problem to calculate the distance of each star individually and more elegant. The plot time is not really influenced using the processing power of modern CPU's. I will experiment today a little further and come back on this .

Han

Patrick Chevalley

20-12-31 12:57

administrator   ~0006872

This is not a big problem for CdC to get some extra stars to reject because this is the first thing the program do after converting to screen coordinates, so there is no try to plot this stars.

han

20-12-31 15:34

reporter   ~0006873

Okay I have implemented a more rigorous method which works well with the same processing speed.

The rigorous method is implemented in a new procedure ang_sep_fast where cos, sin and arccos values are read from arrays rather then being calculated. High accuracy is not required. This gives the best performance.

For short distances the angular seperation is calculated using a simpler method but using the star declination rather then screen center declination. Also the cos array "cos_value" is used for speed.

Just check the the factors *1.5/2 in line 3233 and in 3238. If it is the diameter, the factor should be 1.5/2. If it is the radius the factor is 1.5. Too small factor will remove stars in the corners of the window.

    delta_ra:=abs(ra2-telescope_ra); if delta_ra>pi then delta_ra:=pi*2-delta_ra;
    if delta_ra>pi/3 then
    begin {far away in ra}
      ang_sep_fast(telescope_ra,telescope_dec,ra2,dec2, sep );{calculate seperation using rigorous method but with approximate cos and sin and cos values from tables}
      in_sight:=sep<(field_diameter * 1.5/2);{star in sight?}
    end
    else
    begin {nearby in ra}
      sep:=(sqr( delta_ra*cos_value[round(dec2*180/pi)] ) + sqr(dec2-telescope_dec));{calculate seperation using approximate method for shorter distances}
      in_sight:=sep<sqr(field_diameter * 1.5/2); {{star in sight? sqr(field_diameter) is faster then sqrt(seperation)}
    end;

See attached updated u_290.pas. I haven't compiled it but it should work since I copied the parts from my code.
u_290 version2.zip (20,956 bytes)

Patrick Chevalley

21-01-01 11:08

administrator   ~0006874

Happy New Year Han!

The new method work very well. Good idea to use table for speed, old trick are sometime still useful.
The only change I do to make the compilation to work is to add the local variable in_sight:boolean to the function readdatabase290.
I also remove a multiplier of 1.5 to the fov I have in CdC, now it work without that.

https://github.com/pchev/skychart/commit/43a300f8a647a6dfe702ab8e890a87f76137120a

Issue History

Date Modified Username Field Change
20-12-30 18:33 han New Issue
20-12-30 18:33 han File Added: cdc.png
20-12-30 18:33 han File Added: u_290.zip
20-12-30 22:24 han Note Added: 0006866
20-12-31 10:06 Patrick Chevalley Status new => resolved
20-12-31 10:06 Patrick Chevalley Resolution open => fixed
20-12-31 10:06 Patrick Chevalley Fixed in Version => 4.3 beta
20-12-31 10:06 Patrick Chevalley Target Version => 4.4
20-12-31 10:06 Patrick Chevalley Description Updated
20-12-31 10:06 Patrick Chevalley Note Added: 0006867
20-12-31 10:12 han Status resolved => new
20-12-31 10:12 han Resolution fixed => reopened
20-12-31 10:12 han Note Added: 0006868
20-12-31 12:57 Patrick Chevalley Note Added: 0006872
20-12-31 15:34 han Note Added: 0006873
20-12-31 15:34 han File Added: u_290 version2.zip
21-01-01 11:08 Patrick Chevalley Note Added: 0006874