class AstroToolkit.Data.spectrumquery.SpectrumStruct[source]

This structure is returned from spectrum queries, when read from a data file that was originally created by an spectrum query, or through the Models module (in which case all attributes are set to None).

Attributes

kindstr

“spectrum”

surveystr

survey to which the data belongs

sourceint

Gaia source ID of target system (if given, else None)

poslist<float>

Position of target system [right ascension, declination] in degrees

identifierstr

Position of target system in JHHMMSS.SS±DDMMSS.SS format

datanamestr

Default file for the savedata() method

plotnamestr

Default file name for the showplot() and saveplot() methods

figureBokeh figure

Stores figures generated by the plot() method

data: dict

Returned data in the form:

"wavelength": [wavelengths (angstroms)]
"flux": [fluxes (erg cm^-2 s^-1 angstrom^-1)]

Methods

exportplot(fname)

Exports the figure stored in the ‘figure’ attribute to a PNG, and saves it to local files. If the data structure doesn’t yet hold a figure, one will be generated with a default configuration first.

Parameters:

fname (str, optional) – file name to same the figure to, defaults to file name given by the data structure’s ‘plotname’ attribute

Returns:

file name to which the figure was saved

Return type:

str


plot(**kwargs)

Plots data contained within a given data stucture and assigns the resulting figure to the data structure’s ‘figure’ attribute.

Note: Some data structures may allow for additional optional arguments, see their specific plot() methods for details.


savedata(fname)

Saves a data structure’s data to local files.

Parameters:

fname (str, optional) – overrides file name, defaults to file name given by the data structure’s ‘dataname’ attribute

Returns:

name of file to which data was saved

Return type:

str


saveplot(fname)

Saves the figure stored in the ‘figure’ attribute to local files without opening it in the web browser. If the data structure doesn’t yet hold a figure, one will be generated with a default configuration first.

Parameters:

fname (str, optional) – file name to save the figure to, defaults to file name given by the data structure’s ‘plotname’ attribute

Returns:

file name to which the figure was saved

Return type:

str


showdata(pprint, print_methods)

Prints data structure to stdout in a readable format.

Parameters:

pprint (bool, optional) – collapse arrays and other objects to improve readability, defaults to True

Returns:

Self


showplot(fname)

Opens the figure stored in the ‘figure’ attribute in the default web browser, and saves it to local files. If the data structure doesn’t yet hold a figure, one will be generated with a default configuration first.

Parameters:

fname (str, optional) – file name to save the figure to, defaults to file name given by the data structure’s ‘plotname’ attribute

Returns:

file name to which the figure was saved

Return type:

str