Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

astrometry.net output .fits file and APT


Recommended Posts

All - I don't have a back yard, so I must plan accordingly, pack everything up, drive to an observing site, etc. Naturally, a remote site is unlikely to have online access so I'm planning and testing to do everything on my local Microsoft Surface laptop.

All seems to work well in ASCOM simulations except PlateSolving. ASTAP is simply non-functional. Never solves successfully when using simulations. I'm using hnsky's Sky Simulator to download images that the APT Camera simulator is connected to (same image path on my laptop). If I upload the image.png file Sky Simulator downloads to astrometry.net it is always successfully solved even when APT PlateCraft fails (in fact, astrometry.net solves the image as PlateCraft is failing to solve it).

If I get out in the woods and ASTAP won't work, I'd like to use a local copy of astrometry.net (installed in WSL2 which works quite well) that uses local files. The output of the solve-field command is an 'image.fits' file with header.

My question is, Can I use this solved image.fits file in APT for GoTo and Sync? I can see the file in the APT IMG tab. I can open it in the ATP Image Preview. I can see the image Info using the APT IMG Info button. But, can I get the data in its header "visible" to APT's Gear>GoTo RA: and GoTo Dec: fields so I can GoTo and Sync?

Thanks.

Link to comment
Share on other sites

I use APT and ASTAP. 

I assume you've installed the ASTAP H17 or H18 star databases?   Make sure you have the correct focal length setting under the "Tools"/ "Object Calculator". It doesn't have to be exact but it helps if it's near otherwise the plate solve times out.

If ASTAP doesn't work APT also allows you to install PS2 and ASPS as alternative plate solvers which you can select under Point Craft/Settings.

I can almost always get one or the other to work.

 

I use APT with EQMOD and Cartes du Ciel. My routine is to slew to the target via CdC.  First time it's always off. Then I take a picture and plate solve. Then click on "sync" in APT under the point craft window. This will synchronize CdC and the scope. Then I go back to CdC and slew to the same target. The scope should only move a very small amount. Then I take another picture and platesolve again to confirm I'm in the right place.

To get CdC to synch with APT make sure you have CdC declared under APT/Tools/Planetarium. Just tick the box.

Cheers

Steve

 

Link to comment
Share on other sites

In case anyone sees this thread in a search, attached is a python script (code also below) to open a .fits file and output the RA/DEC in HMS/DMS for manual use. I still don't know of a way to get APT to use a .fits file directly (that is, get the RA/DEC from the fits file into the GoTo RA: and GoTo DEC: fields of the GEAR tab).

USAGE: convertRA_DEC.py -i <inputfile>

I put the script in a folder in my PATH (I'm using WSL2 in Windows 10) and then run it from the folder where the .fits file is, e.g.,

convertRA_DEC.py -i image.fits.

It outputs:

DESKTOP-JA43EBJ% convertRA_Dec.py -i ./image.fits
RA:  194.696215848
DEC:  55.4703270876
Coordinates of center of image:  12:58:47.092 +55:28:13.178
RA:  (12, 58, 47.09180352000203)
DEC:  (55, 28, 13.177515359991476, 1)

If you have the astrometry.net local install so you can use solve-field on an image taken with your camera, you can have solve-field output an image.fits file (which has RA and DEC in decimal format). Run this script on that .fits file, and get the RA/DEC in a format APT can use (or other apps, if they cannot use decimal format, like APT).

#!/usr/bin/python3.8

from __future__ import print_function, division
import sys, getopt
from astropy.io import fits
from PyAstronomy import pyasl
# from astropy.wcs import WCS

# from __future__ import print_functon, division
# from PyAstronomy import pyasl

# # Coordinates of HD 1 from SIMBAD
# hd1 = "00 05 08.83239 +67 50 24.0135"

# print("Coordinates of HD 1 (SIMBAD): ", hd1)

# # Obtain decimal representation
# ra, dec = pyasl.coordsSexaToDeg(hd1)
# print("Coordinates of HD 1 [deg]: %010.6f  %+09.6f" % (ra, dec))

# # Convert back into sexagesimal representation
# sexa = pyasl.coordsDegToSexa(ra, dec)
# print("Coordinates of HD 1 [sexa]: ", sexa)

# ====

# >>> from astropy.io import fits
# >>> from astropy.wcs import WCS
# >>> f = fits.open(<filepath>)
# >>> w = WCS(f[0].header)
# >>> sky = w.pixel_to_world(30, 40)
# >>> print(sky)
# <SkyCoord (ICRS): (ra, dec) in deg
#     (5.52844243, -72.05207809

# ====


def main(argv):
    # print (sys.argv)

    inputfile = ''

    try:
        opts, args = getopt.getopt(argv, "hi:", ["ifile="])

    except getopt.GetoptError:
        print('USAGE: convertRA_DEC.py -i <inputfile>')
        sys.exit(2)

    for opt, arg in opts:
        if opt == '-h':
            print('USAGE: convertRA_DEC.py -i <inputfile>')
            sys.exit()
        elif opt in ("-i", "--ifile"):
            inputfile = arg
            hdul = fits.open(inputfile)
            hdr = hdul[0].header
            print("RA: ", hdr['CRVAL1'])
            print("DEC: ", hdr['CRVAL2'])
            sexa = pyasl.coordsDegToSexa(hdr['CRVAL1'], hdr['CRVAL2'], fmt=('%02d:%02d:%06.3f ', '%s%02d:%02d:%06.3f'))
            # outputs as HMS values for both RA and DEC
            print("Coordinates of HD 1 [sexa]: ", sexa)
            # or, print RA and DEC separately
            print("RA: ", pyasl.degToHMS(hdr['CRVAL1']))
            print("DEC: ", pyasl.degToDMS(hdr['CRVAL2']))

            hdul.close()

if __name__ == "__main__":
    main(sys.argv[1:])

 

convertRA_DEC.py

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.