Skip to main content

A package for the gathering and plotting of astronomical data.

Project description

AstroToolkit

AstroToolkit (ATK) is a set of useful tools for fetching, plotting, and analysing astronomical data.

Table of Contents

  1. Installation
  2. Introduction
  3. Configuration
  4. Tools

ATK Tools


Installation

The package can be installed as with any other package, e.g. using pip:

pip install AstroToolkit

Once the package has been installed, you should navigate to the package install location. This should be located in: .../Lib/site-packages/AstroToolkit, where ... is your python install location. If you wish to find this, you can use the following command from the terminal:

python -c "from AstroToolkit.Tools import getpath; getpath()"

In this directory, run either buildwin.bat (Windows) or build.sh (Linux) depending on your operating system.

NOTE: See README.txt (Linux) or README - Windows.txt (Windows) in the above directory for any additional dependencies.


Introduction

ATK uses Bokeh as its primary plotting library. The official documentation can be found at https://bokeh.org/. A key property of Bokeh plots is that they can be saved as static .html files, which can then be shared/accessed while retaining all interactivity.

Fundamentally, there are two types of tools in ATK:

  1. Fetching, used to obtain data from a given survey
  2. Plotting, used to plot the data acquired from the above

In all fetching tools, there are two possible ways to target your system of interest:

  1. pos = [ra,dec] in degrees
  2. source = Gaia Source ID

Where possible, it is usually best to use a source as input, as this enables a key feature of ATK: Proper Motion Correction.

A good example of this is in imaging queries. If a 'pos' is used as input, the result will simply be the image data returned by the chosen imaging survey at those exact coordinates. However, this may not be ideal in the case of an object with a large proper motion. If a source is used instead, the data returned will have accounted for this, resulting in the image being centered on the system in question. This concept is used throughout ATK when matching data from different surveys to a given system.


All ATK tools can be imported using:

from AstroToolkit.Tools import [tool name]

Configuration

Most default arguments within ATK can be modified through the use of a config file. This can be edited through use of the editconfig tool.

Usage:

editconfig(options)

where options is a dictionary containing key : value pairs to set in the config. The list of accepted keys and their default values are shown below:

  • enable_notifications = False
    • If True, notifications denoting basic information as each ATK tool is executed will be shown in the terminal. Can be useful for tracking the flow of data.
  • dataquery_radius = 3
    • This sets the default radius (in arcseconds) to use in the dataquery tool.
  • photquery_radius = 3
    • This sets the default radius (in arcseconds) to use in the photquery tool.
  • bulkphotquery_radius = 3
    • This sets the default radius (in arcseconds) to use in the bulkphotquery tool.
  • imagequery_size = 30
    • This sets the default radius (in arcseconds) to use in the imagequery tool.
  • imagequery_overlays = gaia
    • This sets the default radius (in arcseconds) to use in the imagequery tool.
  • lightcurvequery_radius = 3
    • This sets the default radius (in arcseconds) to use in the lightcurvequery tool.
  • atlas_username = None
    • This sets the default username to use for ATLAS lightcurve queries in the lightcurvequery tool.
  • atlas_password = None
    • This sets the default password to use for ATLAS lightcurve queries in the lightcurvequery tool.
  • sed_radius = 3
    • This sets the default radius to use in the sedquery tool.
  • spectrum_radius = 3
  • grid_size = 250
    • This sets the default grid size to use in the gridsetup tool.
  • button_simbad_radius = 3
    • This sets the default radius to use for the SIMBAD button in the getbuttons tool.
  • button_vizier_radius = 3
    • This sets the default radius to use for the Vizier button in the getbuttons tool.
  • plot_size = 400
    • This sets the default plot size for all plotting tools.
  • readfits_sourcename = source_id
    • This sets the default column name to use in the getsources

Example:

To set the default username and password to use for ATLAS queries:

from AstroToolkit.Tools import editconfig

editconfig({'atlas_username':'USERNAME','atlas_password':'PASSWORD'})

To see the current value of a config parameter, you can use the getconfigvalue tool. This will return the parameter's value, and print it to the terminal.

Usage:

getconfigvalue(parameter)

where:

parameter = string, name of config parameter from above list

Returns: value of this parameter in the config.



Tools

In this section, the available tools will be outlined. Note that if a parameter is listed as having a default parameter CONFIG, this means that this parameter is taken from the config as listed above. These parameters can still be passed to the tool, in which case the config value will be ignored.

Note: most data returned from fetching/plotting tools takes the form of a dictionary. This dictionary contains the returned data, as well as basic information such as the pos/source used to acquire the data. This format is then used by other ATK functions (such as file showing/saving/reading).

Note: All plots created by ATK can have their legends toggled by double clicking the plot, and individual data can be hidden by clicking them in the legend.


In all data returned by querying tools, the value of the 'data' key will be set to None if no data was returned. Likewise, in all plotting tools, the value of the 'plot' key will be set to None.


1. Raw Data Tools

1.1. dataquery

Returns all available data for a given survey (e.g. magnitudes, positions, etc.).


Supported surveys: gaia, galex, rosat, panstarrs, skymapper, sdss, twomass, wise, erosita


Usage:

dataquery(survey,pos=None,source=None,radius=CONFIG)

where:

survey = str, name of a supported survey
pos = list, [ra,dec]
source = int/str, Gaia source_id
radius = int/float, radius of query

Returns: dict

{
'survey' : str, survey of data
'type' : 'data'
'source' : int/str, source used to get data (None if a pos was used)
'pos' : [ra,dec], pos used to get data (None if a source was used)
'data' : dict, the returned data
}

Example:

To retrieve the parallax of a system through Gaia, and its WISE data:

from AstroToolkit.Tools import dataquery

source = 6050296829033196032

parallax = dataquery(survey='gaia',source=source)['data']['parallax']
wise_data = dataquery(survey='wise',source=source)['data']



1.2. photquery

Returns data from a given survey, with columns filtered to only include photometry and other basic information.


Supported surveys: gaia,panstarrs,skymapper,galex,rosat,sdss,wise,twomass


Usage:

photquery(survey,pos=None,source=None,radius=CONFIG)

where:

survey = str, name of a supported survey
pos = list, [ra,dec]
source = int/str, Gaia source_id
radius = int/float, radius of query

Returns: dict

{
'survey' : str, survey of data
'type' : 'data'
'source' : int/str, source used to get data (None if a pos was used)
'pos' : [ra,dec], pos used to get data (None if a source was used)
'data' : dict, the returned data
}

Example:

To retrieve the 2MASS photometry for an object:

from AstroToolkit.Tools import photquery

data=photquery(survey='twomass',source=6050296829033196032)['data']

1.3. bulkphotquery

Returns available photometry from all surveys supported by photquery.


Usage:

bulkphotquery(pos=None,source=None,radius=CONFIG)

where:

pos = list, [ra,dec]
source = int/str, Gaia source_id
radius = int/float, radius of query

Returns: dict

{
'type' : 'bulkphot'
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'data' : {
         'gaia' : dict, returned data (or None if no data returned)
         'galex' : dict, returned data (or None if no data returned)

          etc. for each survey in surveys supported by photquery
         }
}

Note: The value of each survey will be set to None if no data was returned. E.g. if no galex data was returned, the value of the ['galex'] key would be None.


Example:

To retrieve the gaia and galex data for an object:

from AstroToolkit.Tools import bulkphotquery

bulk_phot=bulkphotquery(source=6050296829033196032)['data']

gaia_data=bulk_phot['gaia']
galex_data=bulk_phot['galex']

1.4. getreddening

Returns the reddening of a Gaia source.

Currently supported reddening surveys:


Usage:

getreddening(source)

where:

source = int/str, Gaia source_id

Returns: dict

{
'type' : 'reddening'
'source' : int/str, source used to get data (None if a pos was used)
'data' : {
         'dist' : distance to source (1/parallax)
         'red_dist' : actual distance to which survey's reddening estimate refers
         'red_dist_err' : error on red_dist
         'red' : survey's reddening estimate
         'red_upper' : reddening upper limit
         'red_lower' : reddening lower limit
         }
}



2. Imaging Tools

These functions retrieve and plotimages from supported surveys.

Note: When using a 'pos' as input, some detections can be missing for high proper motion objects. When instead using a source as input, this is no longer a problem as the detection search radius is increased to account for this proper motion.


2.1. imagequery

Retrieves an image from a given survey. Overlays can be used to overlay detections from different surveys. There are two types of overlay: detections and tracers. Detections are proper motion-corrected circles that scale with the magnitude of the detection, and show that there is data available for a given object in a given survey.

Tracers (which are detections created from lightcurve surveys) can be used both to show that lightcurve data is available, but also to trace an object through time.

Note: tracing an object through time works best with ZTF and CRTS overlays, as these give data with the necessary coordinate precision. Other tracer overlays are unlikely to work for this, and will hence only be useful to see where lightcurve data is available.

Note: In the case of ATLAS overlays, the radius used is very small due to the time taken to perform ATLAS queries. Only data close to the focus of the image (i.e. at the location of the target object) will be shown.

Example:


Supported surveys:

  • panstarrs, supported bands = g, r, i, z, y
  • skymapper, supported bands = g, r, i, z, u, v
  • dss, supported bands = g

Note: Can also use 'any' to perform an image query according to the hierarchy: panstarrs > skymapper > dss


Supported overlays: gaia, galex_nuv, galex_fuv, rosat,sdss, twomass, wise, ztf, erosita ,atlas, gaia_lc, asassn, crts

Note: Can also use 'all', which will enable overlays for all supported surveys.


Usage:

imagequery(survey,pos=None,source=None,size=CONFIG,band='g',overlays=CONFIG)

where:

survey = str, name of a supported survey
pos = list, [ra,dec]
source = int/str, Gaia source_id
size = int/float, size of image in arcsec
band = str, string containing the required bands (e.g. for all panstarrs bands, use band='grizy')
overlays = str, required detection overlays (e.g. for gaia and wise detections, use overlays='gaia,wise') 

Returns: dict

{
'type' : 'image'
'survey' : str, image survey
'source' : int/str, source used to get image (None if a pos was used)
'pos' : [ra,dec], pos used to get image (None if a source was used)
'data' : {
         'image_data' : array, image data
         'image_header' : astropy header, image header
         'location' : [ra,dec], actual location of the image
         'size' : int/float, image size in arcsec
         'image_time' : [year,month], image time
         'wcs' : astropy wcs object of image
         'overlay' : list of overlay entries
         }
}

NOTE: overlays are stored as a list of individual detections in the format:

{
'survey' : str, survey of detection
'position: [ra,dec], coordinates of detection
'radius' : float, radius of detection
'corrected' : bool, whether or not the detection has been corrected for proper motion
'mag' : str, name of the magnitude (column heaader) from a given survey
'marker' : 'circle' or 'cross', detection symbol to overlay. Circles are scaled with radius, crosses are not (e.g. for surveys without a magnitude to scale by)
}

2.2. plotimage

Plots images in format returned by imagequery.


Usage:

plotimage(data)

where:

data = dict in format returned by imagequery

Returns: dict

{
'type' : 'image'
'survey' : str, survey of image
'source' : int/str, source used to get image (None if a pos was used)
'pos' : [ra,dec], pos used to get image (None if a source was used)
'plot' : bokeh figure object, the actual plot
'ATKfilename' : the default filename given by ATK
}

Note: if a plot is not returned (e.g. if no data was supplied to the plotting tool), the 'plot' key will be set to None.


Example:

To retrieve and plot an image:

from AstroToolkit.Tools import imagequery,plotimage,showplot

image=imagequery(survey='any',source=6050296829033196032,overlays='gaia')
plot=plotimage(image)
showplot(plot)



3. HRD Tools

3.1. plothrd

Returns a HRD with a source or list of sources overlayed over a Gaia 100pc background sample.


Usage:

plothrd(source=None,sources=None)

where:

source = int/str, Gaia source_id
sources = list of sources

Returns: dict

{
'type' : 'hrd'
'source' : int/str, source overlayed in HRD
'sources' : list, sources overlayed in HRD if multiple were given
'plot' : bokeh figure object, the actual plot
'ATKfilename' : the default filename given by ATK
}

Example: To retrieve a HRD with a single source overlayed:

from AstroToolkit.Tools import plothrd,showplot

plot=plothrd(source=6050296829033196032)
showplot(plot)



4. Lightcurve Tools

4.1. lightcurvequery

Returns lightcurve data for a given survey.


Supported surveys:

  • ZTF (ztf) - g, r, i
  • ATLAS (atlas) - o, c, i
  • ASAS-SN (asassn) - g, v
  • Gaia (gaia) - g, bp, rp
  • CRTS (crts) - v

Note: CRTS' data server is not designed for scripted queries. As a result, queries are limited in the toolkit to one query per 15 seconds. This cooldown is managed using the CRTS_TIMER.txt file in the Settings directory of the package files, and hence this should not be edited.


lightcurvequery(survey,pos=None,source=None,radius=CONFIG,username=CONFIG,password=CONFIG,sigmaclip=None)

where:

survey = str, name of a supported survey
pos = list, [ra,dec]
source = int/str, Gaia source_id
radius = int/float, radius of lightcurve query
username = str, ATLAS username, hence only used in ATLAS queries
password = str, ATLAS password, hence only used in ATLAS queries
sigmaclip = int, performs sigma clipping on the data to this number of standard deviations

Returns: list of dicts

list of lightcurve data dictionaries with an entry for each band in that survey (see below). Each entry has the format:

{
'type' : 'lightcurve'
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'survey' : str, survey of data
'band' : str, band of lightcurve data
'data' : {
         'ra' : list of returned ra values
         'dec' : list of returned dec values
         'hjd'/'mjd' : list of returned hjd/mjd values, with the minimum returned
          value subtracted from all values (i.e. is just a measure of days from the 
          first observation)
         'hjd_ori'/'mjd_ori' : list of returned hjd/mjd values, unedited
         'mag' : list of returned magnitude values
         'mag_err' : list of returned magnitude error values
         }
}

4.2. plotlightcurve

Plots lightcurves in the format returned by lightcurvequery.


Usage:

plotlightcurve(data,colour='black')

where:

data = dict if passing a single lightcurve, list of dicts if passing multiple lightcurves
colour = str, name of a supported colour. Only used when passing a single lightcurve
colours = list of strings denoting supported colours, e.g. ['green','red','blue']. Only used when passing multiple lightcurves

Returns: dict

{
'type' : 'lightcurve'
'survey' : str, survey of lightcurve
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'plot' : bokeh figure object, the actual plot
'ATKfilename' : the default filename given by ATK
}

Example: To retrieve and plot lightcurves from ZTF:

from AstroToolkit.Tools import lightcurvequery,plotlightcurve,showplot

lightcurves=lightcurvequery(survey='ztf',source=6050296829033196032)
showplot(plotlightcurve(lightcurves,colours=['green','red','blue']))

Note: Each band will then be toggleable using the legend.



5. SED Tools

5.1. sedquery

Queries all supported photometry surveys and returns SED data.


Usage:

sedquery(pos=None,source=None,radius=CONFIG)

where:

pos = list, [ra,dec]
source = int/str, Gaia source_id
radius = int/float, radius of data query

Returns: dict

{
'type' : 'sed'
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'data': list of entries with each entry taking the form of a dict:
	{
    'survey' : str, survey of data point
    'wavelength' : filter wavelength of data point
    'flux' : flux through filter
    'rel_err' : relative error on flux
    }
}

5.2. plotsed

Plots SEDs in the format returned by sedquery.


Usage:

plotsed(data)

where:

data = dict in format returned by sedquery

Returns: dict

{
'type' : 'sed'
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'plot' : bokeh figure object, the actual plot
'ATKfilename' : the default filename given by ATK
}

Example: To retrieve and plot an SED:

from AstroToolkit.Tools import sedquery,plotsed,showplot

data=sedquery(source=6050296829033196032)
showplot(plotsed(data))



6. Spectrum Tools

6.1. spectrumquery

Returns spectrum data from a given survey.


Usage:

spectrumquery(survey=None,pos=None,source=None,radius=CONFIG)

where:

survey = str, name of a supported survey
pos = list, [ra,dec]
source = int/str, Gaia source_id
radius = int/float, radius of data query

Returns: dict

{
'type' : 'spectra'
'survey' : str, survey of detection
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'data': {
        'wavelength' : list of wavelength values
        'flux' : list of flux values
        }
}

6.2. plotspectrum

Plots spectra in the format returned by spectrumquery.


Usage:

plotspectrum(data)

where:

data = dict in format returned by spectrumquery

Returns: dict

{
'type' : 'spectrum'
'survey' : str, survey of spectrum
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'plot' : bokeh figure object, the actual plot
'ATKfilename' : the default filename given by ATK
}

Example: To retrieve and plot an SDSS spectrum:

from AstroToolkit.Tools import spectrumquery,plotspectrum,showplot

data=spectrumquery(survey='sdss',source=587316166180416640)
plot=plotspectrum(data)
showplot(plot)



7. Timeseries Tools

7.1 plotpowspec

Plots a power spectrum from lightcurve data in the format returned by lightcurvequery


Usage:

plotpowspec(data)

where:

data = dict or list in format returned by lightcurvequery

Returns: dict

{
'type' : 'powspec'
'survey' : str, survey of lightcurve data given to the powspec tool
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'plot' : bokeh figure object, the actual plot
'ATKfilename' : the default filename given by ATK
}

Example: To retrieve lightcurve data from ZTF and plot a power spectrum:

from AstroToolkit.Tools import lightcurvequery,plotpowspec,showplot

data=lightcurvequery(survey='ztf',source=6050296829033196032)
plot=plotpowspec(data)
showplot(plot)



7.2 tsanalysis

Runs period analysis on lightcurve data in format returned by lightcurvequery


Usage:

tsanalysis(data)

where:

data = dict or list in format returned by lightcurvequery

Example: To retrieve lightcurve data from ZTF and perform timeseries analysis:

from AstroToolkit.Tools import lightcurvequery,tsanalysis

data=lightcurvequery(survey='ztf',source=6050296829033196032)
plot=tsanalysis(data)



8. Datapage Tools

These functions are used to create custom datapages from any plots/data supported by AstroToolkit.

NOTE: An example of datapage creation can be found within the packages 'Examples' folder, named 'datapage_creation.py' (within the …/Lib/site-packages/AstroToolkit from earlier). This can be imported from a python terminal using from AstroToolkit.Examples import datapage_creation.

Below is the datapage produced by this example. Once the script to create these has been written, they can be a very powerful way to quickly retrieve and show a wide range of information on a system, with the below example easily being generated in under 30s.


8.1. gridsetup

Formats plots for datapage creation by sizing them to a grid of given dimensions.


Usage:

getgrid(dimensions,plots,grid_size=CONFIG)

where:

dimensions = dict, dict with keys 'width' and 'height' that define the dimensions of the datapage in grid units (e.g. for a datapage that is 6 units wide and 3 units tall, dimensions={'width':6,'height':3})
plots = list of plots, with each entry having the format:
        {
        'name' : the label to give to the plot
        'figure' : the plot dictionary as returned by plotting tools
        'width' : the width in grid units of this element
        'height' : the height in grid units of this element
        }
grid_size  = int, size of each square of the grid to which all plots are scaled.

Returns: dict

{
'name 1' : plot 1
'name 2' : plot 2

etc. for each plot given to the tool
}

where the keys "name ..." are the names given to the plots above, and the values 'plot ...' are the plots to which these names refer.

NOTE: Again, see the datapage_creation example as noted above for an example.


8.2. getbuttons

Returns a Bokeh figure containing SIMBAD and Vizier buttons for use in datapages.


Usage:

getinfobuttons(grid_size,source=None,pos=None,simbad_radius=CONFIG,vizier_radius=CONFIG)

where:

grid_size = int, size of the grid to which the buttons are scaled.
pos = list, [ra,dec] in degrees
source = int/str, Gaia source_id
simbad_radius = int, radius to use in SIMBAD queries
vizier_radius = int, radius to use in Vizier queries

Returns: dict

{
'type' : 'buttons'
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'plot' : bokeh figure object, the actual plot element
}

NOTE: Again, see the datapage_creation example as noted above for an example.


8.3. getmdtable

Creates a table of metadata table using data from supported surveys and/or custom data.


Usage:

getmdtable(metadata,pos=None,source=None)

where:

metadata = dict, dictionary of metadata in accepted format (see below)
pos = list, [ra,dec] in degrees
source = int/str, Gaia source_id

The expected metadata format is:

{
'gaia' : {
         'parameters' : names of parameters (i.e. column headers) that exist in that
          survey
         'errors' : names of errors (i.e. column headers) for these parameters that
          exist in that survey
         'notes' : str, any notes to include on this parameter/error/etc.
         }
}

etc. for any supported survey

If a key is provided that is not the name of a supported survey, that key will be interpreted as a custom entry.

In this case, an additional 'values' key must be included, and the values/errors must be passed manually.

{
'custom' : {
           'parameters' : names of parameters
           'values' : parameter values
           'errors' : error values
           'notes' : str, any notes to include on this parameter/error/etc.
           }
}

Returns: dict

{
'type' : 'metadata'
'source' : int/str, source used to get data (None if a pos was used)
'pos': [ra,dec], pos used to get data (None if a source was used)
'plot' : bokeh figure object, the actual plot element
}

NOTE: Again, see the datapage_creation example as noted above for an example.



9. File Handling Tools

These tools can be used to transform many returned ATK data structures into local files, and vice versa. This process is designed to be completely lossless, allowing for the exact data structure that was used to create a file to be recreated at a later date.


9.1. savedata

This tool allows for the saving of many ATK data structures into local files.

Supported ATK data types: data, phot, bulkphot, image, sed, spectra, lightcurve


Usage:

savedata(data)

where:

data = any of the supported data structures from ATK

Returns: str

Name of file that the data was saved to


Note: Created files will contain a tag (e.g. ATKimage for an image). This is necessary, as it tells the readdata function (see below) how to interpret the file to recreate the original data structure.


9.2. readdata

This tool allows for the lossless recreation of ATK data stuctures from files created using savedata.


Usage:

readdata(filename)

where:

filename = str, name/path of ATK file to read

Returns: ATK datastructure that was used to create the file


Example: ATLAS lightcurve queries can take a long time (5-10 minutes). It is therefore useful to be able to save these to a local file for later use.

The following example shows how to fetch ATLAS lightcurve data, save it to a local file, read this local file to recover the data, and then plot it.

from AstroToolkit.Tools import lightcurvequery,savedata,readdata,plotlightcurve,showplot

lightcurve_data=lightcurvequery(source=6050296829033196032,survey='atlas')
fname=savedata(lightcurve_data)

recreated_lightcurve_data=readdata(fname)
showplot(plotlightcurve(recreated_lightcurve_data,colours=['red','orange','yellow']))

Note: The above example assumes that you have already set a default ATLAS username / password in the config.


9.3. export

This allows for ATK figures to be saved as a .png file.


Usage:

export(plot,keephtml=True)

where:

plot = bokeh figure object
keephtml = bool. To get the filename for the png, the plot must first be saved as a regular bokeh static html file. This tells ATk whether to delete this file or keep it.



10. Miscellaneous Tools

These are tools that do not fit into the above categories, but can still be useful for quickly performing some basic functions.


10.1. showplot

This allows for the plot dictionaries returned by ATK to be opened in the browser. Doing so will also save the plot locally as a .html file. Can also be used with the same functionality as show() from bokeh for non-ATK bokeh figures.


Usage:

showplot(plot)

where:

plot = ATK plot dictionary

10.2. saveplot

This allows for the plot dictionaries returned by ATK to be saved to local .html files without opening them in the browser. Can also be used with the same functionality as save() from bokeh for non-ATK bokeh figures.


Usage:

saveplot(plot)

where:

plot = ATK plot dictionary

10.3. correctpm

Corrects for proper motion of an object between an input time and a target time.


Usage:

correctpm(inputtime,targettime,ra,dec,pmra,pmdec)

where:

inputtime = [year,month] where both entries are integers
targettime = [year,month] where both entries are integers
ra = float, ra of object in degrees
dec = float, dec of object in degrees
pmra = float, proper motion in ra direction of object in mas/yr
pmdec = float, proper motion in dec direction of object in mas/yr

Returns: list

[ra,dec] of object in degrees, corrected for proper motion.


Example: To correct an object for proper motion to the year 2000:

from AstroToolkit.Tools import dataquery,correctpm

gaia_data=dataquery(survey='gaia',source=6050296829033196032)['data']
ra,dec,pmra,pmdec=gaia_data['ra'][0],gaia_data['dec'][0],gaia_data['pmra'][0],gaia_data['pmdec'][0]

ra_corrected,dec_corrected=correctpm([2016,0],[2000,0],ra,dec,pmra,pmdec)

10.4. getdistance

Simply calculates the distance (1/parallax) of an object given its parallax in mas (the unit of parallax in Gaia).


Usage:

getdistance(parallax)

where:

parallax = float, parallax of object in mas

Returns: float

distance of object in pc


10.5. convfromdeg

Converts deg coordinates to HMS/DMS format


Usage:

convfromdeg(pos)

where:

pos = list, [ra,dec] of object in degrees

Returns: list

[ra,dec] of object in [HMS,DMS]


10.6. convtodeg

Converts HMS/DMS coordinates to deg.


Usage:

convfromdeg(pos)

where:

pos = list, [ra,dec] of object in [HMS/DMS] format, i.e. [[H,M,S],[D,M,S]]

Returns: list

[ra,dec] of object in deg


10.7. getcolumn

Returns a list of values from a .fits file given a column name.

Usage:

getcolumn(file_name,col_name)

where:

file_name = str, name of file with or without the .fits extension.
col_name = str, name of column in file

Returns: list

list of values for that column


10.8. getsources

Returns a list of source values from a .fits file given a column name, which can either be set in the tool or in the config.

Usage:

getsources(file_name,col_name=CONFIG)

where:

file_name = str, name of file with or without the .fits extension.
col_name = str, name of column containing Gaia sources

Returns: list

list of Gaia sources


10.9. getpositions

Returns a list of ra,dec values from a .fits file given ra and dec column names, which can either be set in the tool or in the config.

Usage:

getsources(file_name,col_name=CONFIG)

where:

file_name = str, name of file with or without the .fits extension.
col_name = str, comma separated string containing names of ra and dec columns. e.g. col_name = 'RA_ICRS,'DE_ICRS'. Must be in this order.

Returns: list

list of positions [[ra1,dec1],[ra2,dec2]], etc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AstroToolkit-1.3.2.tar.gz (1.3 MB view hashes)

Uploaded Source

Built Distribution

AstroToolkit-1.3.2-py3-none-any.whl (1.3 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page