Post a reply

This question is a means of preventing automated form submissions by spambots.
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[flash] is ON
[url] is ON
Smilies are ON

Topic review

Expand view Topic review: ASTAP FITS file


by han.k » 19 Apr 2018, 14:05

Hello Jim,

The team of is flexible.

Note that I just released an ASTAP version with its own internal solver. Very preliminary, but the question comes up if I should keep on supporting PlateSolve2. I could now fully mimic Platesolve2 rather then being an interface.

If you have time, can you have a look to this new internal solver in v0.9.30? Also the questions comes how to interface with other programs. Parameters, IP server?

Clear skies, Han


by jst200 » 18 Apr 2018, 11:10

Hi Han,

Just a brief update.

Dustin has very kindly modified the api to provide the image size in arcseconds.

I've now got my app producing an image Focal Length that is independent of pixel size.

Cheers, Jim


by jst200 » 13 Apr 2018, 19:27

Hi Han,

Once again, thanks again for your thoughtful posts. :)

If I followed your first post, then I think it came to the same as my initial conclusion.

I agree completely with your second post. I don't know why I didn't think of it before, as I only mentioned in a post to someone a few days ago! :roll:

it's such a simple equation: Focal Length = 57.3 * sensor size in mm / FOV in degrees

(where radian to deg conversion Rad = 180/pi = 57.3)

Unfortunately, there is one small problem. Although the anaylsys produces the Image size in degrees, it doesn't provide that data through the API. Which is very strange, since it provides all the other data shown on the image's analysis page :o

I've posted a request on the forum (!topic/ ... h7Y5u6zYJU), but I've had no reply yet. Hopefully something can be done.

Cheers, Jim


by han.k » 12 Apr 2018, 19:55

Hello Jim,

Above is maybe too complicated. You better just use the sensor_size in (micro)meter and image_size in degrees in the same formula. This will give the correct result for the original and stretched image.



by han.k » 12 Apr 2018, 15:39

Hello Jim,

The calculations and keywords are as follows:


where pixel size in micrometer
pixel_astro_size in arc sec

So for your telescope:

So focal length is 0.754 meter.

in SI units:


where pixelsize in meter
pixel_astro_size in degrees


where pixelsize in meters
pixel_astro_size in radians

Pixel size in degrees is given in the FITS header in the old style FITS keyword CDELT2 and sometimes as CDELT1. This keyword is not available in output but you can calculate it using two available transformation matrix keywords cd1_1 and cd2_2 or equivalent if no skew cd2_1 and cd2_2


CDELT1 and CDELT2 are in practice the same

CDELT2:=0.00211009 [degrees]
CDELT2:=7.596323953 [arc min]

The second image is resized by ASTAP, your have to correct the scale to calculate the focal length.
New size is
NAXIS1 = 796 / length of x axis
NAXIS2 = 531 / length of y axis

Old size
NAXIS1 = 4272 / image width
NAXIS2 = 2848 / image height

So original scale was 7.59632* 796/4272==>1.415419913 arc sec/pixel

Or simple you calculated FL=141 mm, so the original focal length was 141* 4272/796

It is nice to have the API running. I haven't mastered that yet. Maybe something to do in future. I'm also playing with the idea to do plate solving using my own code, but that will not be easy.

Regards, Han


by jst200 » 12 Apr 2018, 13:55

Hi Han,

Once again, thanks for the quick and comprehensive explanation! :D
I wondered if it was part of the resolution for the performance issue.

I guess the answer for what I want to do is to build a multiplication factor into the calculation? i.e.

focal_length = 206.264806 * pixel size / pixel scale) * multiplier

where multiplier i= .jpg (or camera) pixel size / .fit pixel size

Is there a way for me to know or calculate the .fit pixel size?

Just so you know why I am asking... :) Using the example API code from, I have created a python app that allows me to programmatically upload an image to be solved, then get and display it's results. From the results I can also add a calculation to show the Focal Length of the image. This is useful for APT, as in APT (as I 'm sure you know) you need to provide the FL for Pointcraft to work. I could easily add a multiplier input field. :geek:

Capture.JPG (46.12 KiB) Viewed 260 times

Thanks again for your help.

Cheers, Jim


by han.k » 12 Apr 2018, 09:54

Hello Jim,

I don't know if you use the viewer, but to assist I added the image dimensions in pixels and degrees to the status bar.

image1.jpg (63.79 KiB) Viewed 261 times


by han.k » 11 Apr 2018, 21:49

Hello Jim,

The difference is due to the scaling of the FITS file in ASTAP. The FITS file produced in pixels is much smaller then the JPEG and therefore the arcsec/pixel is larger. If you look to the FITS file height & width it should be correct.

I looked to the Jpeg and FITS file still available from They are 4272x2848 pixel large. A FITS file of this size s a huge burden to convert and to display in HNSKY or CCDciel or what you are using. People complained it took 60 seconds or more. A few weeks ago, I changed the setup. The FITS file created is much smaller and can be tuned by the window size of ASTAP. A larger ASTAP window it will produce larger FITS file. The window size is saved when you leave ASTAP the program. A size of 400x300 is fine for most users but you could make it as large as the screen.

Working in ASTAP:
1) ASTAP loads the image from the command line. (from APT)
2) ASTAP executes PlateSolve2 with the command.
3) While solving is running, it streches the image to ASTAP window size.
4) If the solution is generated by PlateSolve2, the APM file is read and the ASTAP window is saved to a FITS file (same name but ending with .fit) with the solution keywords adapted to the FITS image dimensions.

So you just have to find the ratio JPG_width/FITS_width to correct.

If you find any other problem, please tell me.
Promotion of ASTAP is appreciated. :)
Regards, Han


by jst200 » 11 Apr 2018, 18:30

Hi Han,

I use the APT/ASTAP integration feature to produce a FIT file when APT does a Platesolve2. The process works brilliantly and doesn't seem to add any time to the solve process.

However, there seems to be a difference between the construct of the original ImageToSolve.jpg file and the created file.

If I use the upload feature, the solved .jpg gives the correct calibration data:
Center (RA, Dec): (98.044, 4.915)
Center (RA, hms): 06h 32m 10.576s
Center (Dec, dms):+04° 54' 54.381"
Size: 1.68 x 1.12 deg
Radius: 1.009 deg
Pixel scale: 1.42 arcsec/pixel
( ... #annotated

The .fit file gives all the same data, except for the Pixel scale:
Center (RA, Dec): (98.044, 4.915)
Center (RA, hms): 06h 32m 10.630s
Center (Dec, dms): +04° 54' 54.298"
Size: 1.68 x 1.12 deg
Radius: 1.009 deg
Pixel scale: 7.6 arcsec/pixel ... #annotated

This means when I calculate the focal length from the .jpg solve I get fl=753mm, which is correct. The .fit solve gives fl=141mm, which is not!
I used the calc: focal_length = 206.264806 * pixel size / pixel scale) where pixel size is 5.19um

Is there a way to correct this? I can provide the two image files, if it helps.

Thanks, Jim