/astrolib

My astronomy routines

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

astrolib Documentation

I decided to create a library from the codes that I use for myself. I hope it will be useful for you too.

And here are our dependencies for this library:

Table of Contents:

Structure of Module

astrolib | |----> astronomy.py | |----> catalog.py | |----> io.py | |----> visuals.py | |----> photometry.py For detailed information and help give help(module_name) command in the command line.

Introduction

Here I created help documentation for the commands I use the frequently. You can work the same way for others. You can find detailed help in the code.

Detecting Sources

%load_ext autoreload
%autoreload 2
from astrolib import astronomy

fo = astronomy.FitsOps("108hecuba-001_R_affineremap.fits")
ds= fo.detect_sources(max_sources=10)
print(ds)
The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

10 objects detected.
    thresh    npix tnpix xmin xmax ... ypeak flag    ra_calc       dec_calc   
------------- ---- ----- ---- ---- ... ----- ---- ------------- --------------
19.1716499329  514   482  770  798 ...   709    0 306.771497336 -23.4704661458
19.1716499329  406   375  491  512 ...   328    0 306.824877954  -23.396690687
19.1716499329  288   275  254  274 ...   447    1 306.874213526 -23.4164391737
19.1716499329  277   256  424  442 ...   380    0 306.839362608  -23.405562815
19.1716499329  198   181  424  440 ...   906    0 306.845308447 -23.5039523172
19.1716499329  194   176  979  994 ...   732    0  306.73060855 -23.4768569137
19.1716499329  191   179  421  436 ...   502    0 306.841689712 -23.4283372785
19.1716499329  186   172  748  763 ...   535    0 306.775505562 -23.4377531371
19.1716499329  217   195  968  983 ...   851    0 306.734126873 -23.4989537639
19.1716499329  146   133  304  317 ...   898    0 306.869815661 -23.5011624192

If you just want to get physical coordinates of sources;

print(ds['x', 'y'])
      x             y      
------------- -------------
784.445069846 708.599934474
501.969623282 328.856251826
265.640606005  447.07089538
433.446658084  379.95420757
432.153302841 906.369369574
 986.64280869 732.173102742
428.481743905  502.05257089
755.619674466  535.11980348
975.565085076 850.958300649
 311.27460779 897.879261611

Plot detected sources

If you want to plot detected objects on the FITS file;

fo.detect_sources(plot=True, max_sources=10)

png

10 objects detected.

<Table length=10>

threshnpixtnpixxminxmaxyminymaxxyx2y2xyerrx2erry2errxyabthetacxxcyycxycfluxfluxcpeakpeakxcpeakycpeakxpeakypeakflag
float64int64int64int64int64int64int64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64int64int64int64int64int64
19.1716499329514482770798696721784.445069846708.5999344747.130377780347.14998870343-0.2123581408727.09243459217e-066.17207043114e-06-1.98509663699e-072.711598634722.63203310966-0.8084688782690.1403691917660.1399841904640.00833806581795723850.0724231.812517705.060546918033.35351567857097847090
19.1716499329406375491512318340501.969623282328.8562518266.851296200456.80527345789-0.2320989369691.135928646e-051.08330602851e-051.04181566067e-062.657352447512.56808257103-0.7359873056410.1461266130210.147114843130.00996751524508443818.09375444089.7513129.044921914977.50585945023295023280
19.1716499329288275254274438457265.640606005447.070895386.239602344276.07421432435-0.2796716715783.41360150936e-053.11016713517e-05-2.11652827665e-062.539399385452.4218313694-0.6416526436810.1605980545280.1649708002810.0147886537015185113.59375185279.531256102.232910167160.669921882664472664471
19.1716499329277256424442371389433.446658084379.954207576.353162226586.31800704473-0.2998433333794.85704037652e-054.50648124042e-05-1.72250253383e-062.576032400132.45666980743-0.7561203837390.1577552855010.1586330682040.0149736674502146899.203125147146.468754537.379882815280.504882814343804343800
19.1716499329198181424440899914432.153302841906.3693695745.903030420035.47633612435-0.1847532566650.0001646224050430.000146496989951-3.67874889536e-062.443748712542.32539439201-0.3568477332590.1695835739370.1827968508010.011442365124857640.042968857828.26953121876.255249022155.505371094329064329060
19.1716499329194176979994725740986.64280869732.1731027425.82860409715.77761345379-0.1236827776740.0001498288619250.000146736762267-1.92272602728e-062.435034275052.38260889053-0.6837545037270.1716456413270.1731605082750.0073489197529957640.687557787.36328121833.149780272154.96215829877329877320
19.1716499329191179421436494509428.481743905502.052570895.730493288785.83927472126-0.082716463680.0001858823948180.0001969069065816.81651164286e-062.425671100622.38450980186-1.076232552530.1745407283310.1712891757490.0049449265934549968.70312550177.3906251583.442504881840.379272464295024295020
19.1716499329186172748763528543755.619674466535.119803485.849523159595.86444076657-0.3025529664080.0001905489472940.000193111256106-1.3837525619e-052.481859445572.35676407814-0.7977221012120.1714114993810.1709754765030.017686616629448653.160156248840.031251514.218017581737.780151377565357565350
19.1716499329217195968983837859975.565085076850.9583006495.450414391988.61544221634-0.3695535180930.0002447681357190.000640536321842-2.73328688175e-052.942451238632.32547569275-1.456090331080.1840074509380.1164092123510.01578574813941191.07812541409.03906251270.405517581463.905395519768519768510
19.1716499329146133304317891904311.27460779897.8792616114.954607708995.00588141734-0.1893835352640.0002520843412260.000276073972364-1.24180158269e-052.274061441422.18840885162-0.8526742458340.2021246105430.2000543177130.015293640084632531.558593832735.93554691089.452880861271.765380863118983118980

Query and match detected objects with the GAIA DR1

from astrolib import catalog
q = catalog.Query()
q.gaia_query(306.77168051, -23.47029011, 0.1, max_sources=5)

<Table masked=True length=5>

SourceRA_ICRSDE_ICRSe_RA_ICRSe_DE_ICRS__Gmag_pmRApmDEe_pmRAe_pmDEEpochPlx
degdegmasmasmagmas / yrmas / yrmas / yrmas / yryrmas
int64float64float64float32float32float32float64float64float32float32float32float32
6849534850623923456306.7733664604-23.51496447590.2620.22117.121--------2015.0--
6849534850623925120306.7712467689-23.51257927340.8700.74919.499--------2015.0--
6849534988062874624306.7217934709-23.51876625260.6900.58919.120--------2015.0--
6849534988062875264306.7263979238-23.51816992390.3250.26417.535--------2015.0--
6849535056782354560306.7183059223-23.51266948630.1960.13317.308--------2015.0--

If you just want to query the target object, reduce the radius like;

from astrolib import catalog
q = catalog.Query()
q.gaia_query(306.77168051, -23.47029011, 0.01, max_sources=5)

<Table masked=True length=1>

SourceRA_ICRSDE_ICRSe_RA_ICRSe_DE_ICRS__Gmag_pmRApmDEe_pmRAe_pmDEEpochPlx
degdegmasmasmagmas / yrmas / yrmas / yrmas / yryrmas
int64float64float64float32float32float32float64float64float32float32float32float32
6849629099386034304306.7717090460-23.47027877420.2160.1269.6038.0594.8160.9100.6192015.03.17

Matching with GAIA DR1

q.match_catalog("108hecuba-001_R_affineremap.fits", plot=True, max_sources=10)
10 objects detected.


/usr/local/lib/python3.6/site-packages/numpy/core/numeric.py:531: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order)

png

Matched objects: 9

<Table length=9>

idxyradece_rae_decg_mean_magpmrapmdece_pmrae_pmdecepochplxfluxabthetara_calcdec_calcra_diffdec_diff
float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64
6.84962909939e+18784.445069846708.599934474306.771709046-23.47027877420.2160000056030.1260000020279.602999687198.0594.8160.9100000262260.6190000176432015.03.17000007629724231.81252.711598634722.63203310966-0.808468878269306.771497336-23.4704661458762.154325162674.53790621
6.84964298072e+18501.969623282328.856251826306.825119424-23.39661054310.1550000011920.096000000834510.1719999313nannannannan2015.0nan444089.752.657352447512.56808257103-0.735987305641306.824877954-23.396690687869.293691494288.518125998
6.84963092045e+18265.640606005447.07089538306.874457724-23.41640263490.349999994040.17100000381511.090999603319.918-7.0571.930999994281.282999992372015.03.65000009537185279.531252.539399385452.4218313694-0.641652643681306.874213526-23.4164391737879.11293615131.539743526
6.84963122969e+18433.446658084379.95420757306.839605839-23.40549171280.1959999948740.14000000059611.3380002975-1.037-1.8961.432999968530.9520000219352015.00.579999983311147146.468752.576032400132.45666980743-0.756120383739306.839362608-23.405562815875.629978918255.967955209
6.84962782808e+18432.153302841906.369369574306.845545923-23.50381569540.2319999933240.16300000250312.3310003281-6.099-11.5841.672000050541.09099996092015.01.1499999761657828.26953122.443748712542.32539439201-0.356847733259306.845308447-23.5039523172854.913985108491.838601999
6.84954694525e+18986.64280869732.173102742306.730808533-23.47662637960.1529999971390.11999999731812.3090000153nannannannan2015.0nan57787.36328122.435034275052.38260889053-0.683754503727306.73060855-23.4768569137719.935376696829.922643453
6.8496409535e+18755.619674466535.11980348306.775712653-23.43759406540.0970000028610.075000002980212.5030002594nannannannan2015.0nan48840.031252.481859445572.35676407814-0.797722101212306.775505562-23.4377531371745.527969957572.658003705
6.84953515986e+18975.565085076850.958300649306.734327716-23.49875473090.1049999967220.08200000226512.7259998322nannannannan2015.0nan41409.03906252.942451238632.32547569275-1.45609033108306.734126873-23.4989537639723.032314954716.51890772
6.84962820603e+18311.27460779897.879261611306.870049861-23.50105919440.1099999994040.072999998927112.875nannannannan2015.0nan32735.93554692.274061441422.18840885162-0.852674245834306.869815661-23.5011624192843.118385296371.609451281

Astrometry with IRAF's ccmap

First of all we need a FITS file that has been resolved with astrometry.net (For example: 108hecuba-001_R_affineremap.fits). Then our code will map the resources found here to the GAIA catalog and again perform astrometry with these coordinates via ccmap.

from astrolib import catalog
from astrolib import astronomy


q = catalog.Query()
# Resolved image with Astrometry.net (108hecuba-001_R_affineremap.fits).
objects_matrix = q.match_catalog("108hecuba-001_R_affineremap.fits", max_sources=20)

ac = astronomy.AstCalc()
# Image with no WCS header keywords (108hecuba-001_R.fits).
ac.ccmap(objects_matrix, "./108hecuba-001_R.fits", ppm_parallax_cor=False)
20 objects detected.

Matched objects: 19
Refsystem: icrs  Coordinates: equatorial ICRS
    Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000
Insystem: icrs  Coordinates: equatorial ICRS
    Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000

Coords File: /Users/ykilic/Documents/playground/coords  Image: ./108hecuba-001_R.fits
    Database: /Users/ykilic/Documents/playground/solutions.txt  Solution: ./108hecuba-001_R.fits
Coordinate mapping status
    XI fit ok.  ETA fit ok.
    Ra/Dec or Long/Lat fit rms: 0.038  0.0485   (arcsec  arcsec)
Coordinate mapping parameters
    Sky projection geometry: tan
    Reference point: 20:27:17.965  -23:27:09.36  (hours  degrees)
    Reference point: 519.031  627.677  (pixels  pixels)
    X and Y scale: 0.673  0.673  (arcsec/pixel  arcsec/pixel)
    X and Y axis rotation: 177.025  176.983  (degrees  degrees)
Wcs mapping status
    Ra/Dec or Long/Lat wcs rms: 0.038  0.0485   (arcsec  arcsec)
Updating image header wcs

<Table length=3>

Ra/Dec or Long/Lat fit rmsRa/Dec or Long/Lat wcs rmsReference point (RA, DEC)Reference point (X, Y)X and Y scaleX and Y axis rotation
str16str16str16str16str28str18
0.0380.03820:27:17.965519.0310.673177.025
0.04850.0485-23:27:09.36627.6770.673176.983
(arcsec arcsec)(arcsec arcsec)(hours degrees)(pixels pixels)(arcsec/pixel arcsec/pixel)(degrees degrees)

You can see the results coordinates with;

ac.ccmap(objects_matrix, "./108hecuba-001_R.fits", ppm_parallax_cor=False, stdout=True)
Refsystem: icrs  Coordinates: equatorial ICRS
    Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000
Insystem: icrs  Coordinates: equatorial ICRS
    Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000

Coords File: /Users/ykilic/Documents/playground/coords  Image: ./108hecuba-001_R.fits
    Database: /Users/ykilic/Documents/playground/solutions.txt  Solution: ./108hecuba-001_R.fits
Coordinate mapping status
    XI fit ok.  ETA fit ok.
    Ra/Dec or Long/Lat fit rms: 0.038  0.0485   (arcsec  arcsec)
Coordinate mapping parameters
    Sky projection geometry: tan
    Reference point: 20:27:17.965  -23:27:09.36  (hours  degrees)
    Reference point: 519.031  627.677  (pixels  pixels)
    X and Y scale: 0.673  0.673  (arcsec/pixel  arcsec/pixel)
    X and Y axis rotation: 177.025  176.983  (degrees  degrees)
Wcs mapping status
    Ra/Dec or Long/Lat wcs rms: 0.038  0.0485   (arcsec  arcsec)
Updating image header wcs

# Refsystem: icrs  Coordinates: equatorial ICRS
#     Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000
# Insystem: icrs  Coordinates: equatorial ICRS
#     Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000

# Coords File: /Users/ykilic/Documents/playground/coords  Image: ./108hecuba-001_R.fits
#     Database: /Users/ykilic/Documents/playground/solutions.txt  Solution: ./108hecuba-001_R.fits
# Coordinate mapping status
#     XI fit ok.  ETA fit ok.
#     Ra/Dec or Long/Lat fit rms: 0.038  0.0485   (arcsec  arcsec)
# Coordinate mapping parameters
#     Sky projection geometry: tan
#     Reference point: 20:27:17.965  -23:27:09.36  (hours  degrees)
#     Reference point: 519.031  627.677  (pixels  pixels)
#     X and Y scale: 0.673  0.673  (arcsec/pixel  arcsec/pixel)
#     X and Y axis rotation: 177.025  176.983  (degrees  degrees)
# Wcs mapping status
#     Ra/Dec or Long/Lat wcs rms: 0.038  0.0485   (arcsec  arcsec)
# Updating image header wcs


# Input Coordinate Listing
#     Column 1: X (pixels)
#     Column 2: Y (pixels)
#     Column 3: Ra / Longitude (hours)
#     Column 4: Dec / Latitude (degrees)
#     Column 5: Fitted Ra / Longitude (hours)
#     Column 6: Fitted Dec / Latitude (degrees)
#     Column 7: Residual Ra / Longitude (arcseconds)
#     Column 8: Residual Dec / Latitude (arcseconds)

   784.445    708.600  20:27:05.210 -23:28:13.00  20:27:05.210 -23:28:13.02   0.005  0.018
   501.970    328.856  20:27:18.029 -23:23:47.80  20:27:18.028 -23:23:47.80   0.005  0.006
   265.641    447.071  20:27:29.870 -23:24:59.05  20:27:29.871 -23:24:59.02  -0.014 -0.026
   433.447    379.954  20:27:21.505 -23:24:19.77  20:27:21.505 -23:24:19.77   0.005  0.002
   432.153    906.369  20:27:22.931 -23:30:13.74  20:27:22.927 -23:30:13.75   0.051  0.013
   986.643    732.173  20:26:55.394 -23:28:35.85  20:26:55.394 -23:28:35.87   0.006  0.013
   755.620    535.120  20:27:06.171 -23:26:15.34  20:27:06.174 -23:26:15.35  -0.037  0.013
   975.565    850.958  20:26:56.239 -23:29:55.52  20:26:56.237 -23:29:55.37   0.022 -0.143
   311.275    897.879  20:27:28.812 -23:30:03.81  20:27:28.811 -23:30:03.80   0.017 -0.014
    29.622    370.084  20:27:41.190 -23:23:58.91  20:27:41.193 -23:23:58.93  -0.044  0.014
   397.766    476.658  20:27:23.496 -23:25:23.58  20:27:23.497 -23:25:23.56  -0.010 -0.017
   670.751    693.912  20:27:10.729 -23:27:59.25  20:27:10.725 -23:27:59.20   0.045 -0.052
   189.583    760.212  20:27:34.392 -23:28:26.92  20:27:34.398 -23:28:26.94  -0.085  0.020
   185.898    512.106  20:27:33.936 -23:25:39.96  20:27:33.933 -23:25:39.95   0.042 -0.009
   577.371    579.237  20:27:14.995 -23:26:38.81  20:27:14.991 -23:26:38.82   0.056  0.008
  1003.779    979.693  20:26:55.184 -23:31:22.81  20:26:55.186 -23:31:22.93  -0.028  0.111
   179.822    591.192  20:27:34.437 -23:26:32.96  20:27:34.435 -23:26:32.92   0.026 -0.031
   221.017    307.520  20:27:31.687 -23:23:23.55  20:27:31.687 -23:23:23.61  -0.001  0.051
   956.476    867.597  20:26:57.208 -23:30:05.88  20:26:57.212 -23:30:05.91  -0.059  0.023

<Table length=3>

Ra/Dec or Long/Lat fit rmsRa/Dec or Long/Lat wcs rmsReference point (RA, DEC)Reference point (X, Y)X and Y scaleX and Y axis rotation
str16str16str16str16str28str18
0.0380.03820:27:17.965519.0310.673177.025
0.04850.0485-23:27:09.36627.6770.673176.983
(arcsec arcsec)(arcsec arcsec)(hours degrees)(pixels pixels)(arcsec/pixel arcsec/pixel)(degrees degrees)

But this solution does not include parallax and proper motion correction. To include these corrections;

ac.ccmap(objects_matrix, "./108hecuba-001_R.fits", ppm_parallax_cor=True)
Refsystem: icrs  Coordinates: equatorial ICRS
    Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000
Insystem: icrs  Coordinates: equatorial ICRS
    Equinox: J2000.000 Epoch: J2000.00000000 MJD: 51544.50000

Coords File: /Users/ykilic/Documents/playground/coords  Image: ./108hecuba-001_R.fits
    Database: /Users/ykilic/Documents/playground/solutions.txt  Solution: ./108hecuba-001_R.fits
Coordinate mapping status
    XI fit ok.  ETA fit ok.
    Ra/Dec or Long/Lat fit rms: 0.0377  0.0486   (arcsec  arcsec)
Coordinate mapping parameters
    Sky projection geometry: tan
    Reference point: 20:27:17.965  -23:27:09.36  (hours  degrees)
    Reference point: 519.031  627.677  (pixels  pixels)
    X and Y scale: 0.673  0.673  (arcsec/pixel  arcsec/pixel)
    X and Y axis rotation: 177.025  176.983  (degrees  degrees)
Wcs mapping status
    Ra/Dec or Long/Lat wcs rms: 0.0377  0.0486   (arcsec  arcsec)
Updating image header wcs

<Table length=3>

Ra/Dec or Long/Lat fit rmsRa/Dec or Long/Lat wcs rmsReference point (RA, DEC)Reference point (X, Y)X and Y scaleX and Y axis rotation
str16str16str16str16str28str18
0.03770.037720:27:17.965519.0310.673177.025
0.04860.0486-23:27:09.36627.6770.673176.983
(arcsec arcsec)(arcsec arcsec)(hours degrees)(pixels pixels)(arcsec/pixel arcsec/pixel)(degrees degrees)

Proper motion correction;

Coordinates α and δ of a star in a fixed reference system change with time proportional to its proper motion μα and μδ. Let α0 and δ0 be its position at some time origin; its values at time t are;

μα = μα∗ / cosδ0

α = α0 + tμα

δ = δ0 + tμδ

Stellar Parallax Correction;

Deltaα = π (x sin α − y cos α) / cos δ

Deltaδ = π [(x cos α + y sin α) sin δ − z cos δ]

where the coordinates x, y, z of the Earth are expressed in astronomical units and the corrections to the position are in arcseconds.

Ref: Kovalevsky, J., & Seidelmann, P. (2004). Fundamentals of Astrometry. Cambridge: Cambridge University Press. doi:10.1017/CBO9781139106832

Solve field with astrometry.net

from astrolib import astronomy

ac = astronomy.AstCalc()

# Solve field with astrometry.net
# Please provide image path, so ./ is important!
ac.solve_field("./5247_0007_R.fits")
Image has been solved!

True
pwd
'/Users/ykilic/Documents/playground'

Copy solved image with FITS file extension.

cp -rv 5247_0007_R.new 5247_0007_R_new.fits
5247_0007_R.new -> 5247_0007_R_new.fits

Plot Asteroids

You may want to plot asteroids, comets etc. on FITS image. Especially this can be very useful to find the moving objects in asteroid observations. Note that in the header of the FITS file, there must be RA, DEC, and DATE-OBS keywords. This code has made use of IMCCE's SkyBoT VO tool.

from astrolib import visuals

ap = visuals.StarPlot()
# time_travel parameter expresses the observation time in hours.
ap.asteroids_plot("./5247_0007_R_new.fits", time_travel=4)

png

num   name      ra(h)       dec(deg)    class   m_v  err(arcsec) d(arcsec)
---- ------ ------------- ------------ -------- ---- ----------- ---------
5247 Krylov 20 58 36.6685 +26 02 0.871 MB>Inner 15.3       0.040   159.851

True

Plot Asteroids without a FITS File

Suppose that you do not have a FITS file, but you want to plot asteroids in the field of view (in arcmin) that you want at a particular time in a particular region. Then you should have indicated the coordinates of the region (RA, DEC) and the time of observation you wanted. No that, time_travel parameter expresses the approximate observation time duration in hours.

from astrolib import visuals

ap = visuals.StarPlot()
ap.asteroids_plot(ra="20 11 38.6159", 
                  dec="-07 09 12.734", 
                  odate="2017-08-15T19:50:00.95", 
                  time_travel=4, 
                  radius=21,
                  max_mag=21)
Target Coordinates: 20:11:38.6159 -07:09:12.734 in 21 arcmin

png

 num      name        ra(h)        dec(deg)   ... m_v  err(arcsec) d(arcsec)
------ ---------- ------------- ------------- ... ---- ----------- ---------
 61174  2000 NN22 20 11 37.0007 -07 09 28.118 ... 17.1       0.088    28.541
368990 2007 EA170 20 11 10.5560 -07 09 25.010 ... 20.8       0.041   417.801
 84962   2003 YM9 20 12 20.6282 -07 04 58.914 ... 19.2       0.080   674.879
     -  2003 UU95 20 11 42.2090 -07 20 33.771 ... 19.1       0.463   683.135
462308  2008 GM89 20 11 47.4887  -07 23 2.466 ... 21.1       0.428   840.175
154028  2002 CV42 20 10 33.0059 -07 15 32.548 ... 19.9       0.063  1047.658
416647  2004 TA96 20 10 40.5785  -07 20 1.355 ... 20.3       0.259  1080.074
490226  2008 VH54 20 10 56.7180 -07 24 32.520 ... 20.8       0.172  1111.152

True

FITS Data Reduction with ccdproc

This class provides simple FITS image data reduction with ccdproc. In order to use RedOps() class of my astrolib, you should have special directory tree like this;

dir/
|    \
BDF/  SCI_IMAGES

Now, you are ready to use RedOps.ccdproc function;

from astrolib import astronomy
import glob
ro = astronomy.RedOps()
ro.ccdproc("./data/20160415N/43032/")
>>> Scientific images are copied!
>>> Calibration images are copied!
>>> Master bias file is created.
>>> Master flat file is created.
>>> ccdproc is working for: 43032_0001_R_new.fits
    [*] Gain correction is done.
    [*] Cosmic correction is done.
    [*] Bias correction is done.
    [*] Flat correction is done.
    [*] ccdproc is done for: 43032_0001_R_new.fits: [#-------------------] 2.63%
>>> ccdproc is working for: 43032_0002_R_new.fits
    [*] Gain correction is done.
    [*] Cosmic correction is done.
    [*] Bias correction is done.
    [*] Flat correction is done.
    ...
>>> ccdproc is working for: 43032_0042_R_new.fits
    [*] Gain correction is done.
    [*] Cosmic correction is done.
    [*] Bias correction is done.
    [*] Flat correction is done.
    [*] ccdproc is done for: 43032_0042_R_new.fits: [####################] 100.0%
DONE

True

You will find your calibrated images under atmp/ directory as named "bf_" prefix.

Photometry of an asteroid

If you want to apply asteroid photometry on a squential FITS images give this commands. Don't forget! All images must have WCS keywords and astrometrically solved. If you change the "multi_object" value as True, asteroids_phot function will perform photometry to all asteroids in the frame queried from SkyBoT.

from astrolib import photometry
from astrolib import visuals
import glob
ap = photometry.PhotOps()
plc = visuals.StarPlot()
ap.asteroids_phot("atmp/*.fits", multi_object=False)
# For plotting ligt curve of results.
plc.lc_plot("43032.txt")
Photometry is done for: atmp/43032_0011_R_new.fits: [--------------------] 0.0%
...
Photometry done!: [####################] 100%
DONE

Plotting asteroid's LC...

png

To be continued! :)