PhotometryData#
- class stellarphot.PhotometryData(*args, input_data=None, colname_map=None, passband_map=None, retain_user_computed=False, **kwargs)[source]#
Bases:
BaseEnhancedTableA modified
astropy.table.QTableto hold reduced photometry data that provides the convenience of validating the data table is in the proper format including units. It returns anPhotometryDatawhich is aastropy.table.QTablewith additional attributes describing the observatory and camera.- Parameters:
- input_data: `astropy.table.QTable`, optional (Default: None)
A table containing all the instrumental aperture photometry results to be validated. Note: It is allowed for the ‘ra’ and ‘dec’ columns to have np.nan values, but if they do, the ‘bjd’ column will not be computed and will also be left with ‘np.nan’.
- observatory: `stellarphot.settings.Observatory`, optional (Default: None)
Information about the observatory.
- camera: `stellarphot.Camera`, optional (Default: None)
A description of the CCD used to perform the photometry.
- colname_map: dict, optional (Default: None)
A dictionary containing old column names as keys and new column names as values. This is used to automatically update the column names to the desired names before the validation is performed.
- passband_map: `stellarphot.settings.PassbandMap`, optional (Default: None)
An object containing a mapping from instrumental passband names to AAVSO passband names. This is used to automatically update the passband column to AAVSO standard names if desired. See the documentation for
stellarphot.settings.PassbandMapfor more information. The object behaves like a dictionary when accessing it.- retain_user_computed: bool, optional (Default: False)
If True, any computed columns (see USAGE NOTES below) that already exist in
datawill be retained. If False, will throw an error if any computed columns already exist indata.
- Attributes:
- camera: `stellarphot.Camera`
A description of the CCD used to perform the photometry.
- observatory: `stellarphot.settings.Observatory`, optional (Default: None)
Information about the observatory.
Notes
For validation of inputs, you must provide camera, observatory, AND input_data, if you do not, an empty table will be returned.
To be accepted as valid, the
input_datamust MUST contain the following columns with the following units. The data in those columns is NOT validated, the values in those columns could be invalid. Furthermore, the ‘consistent count units’ below simply means it can be any unit, but it must be the same for all the columns with ‘consistent count units’.Column name
Unit
star_id
None
RA
u.deg
Dec
u.deg
xcenter
u.pix
ycenter
u.pix
fwhm_x
u.pix
fwhm_y
u.pix
width
u.pix
aperture
u.pix
aperture_area
u.pix
annulus_inner
u.pix
annulus_outer
u.pix
annulus_area
u.pix
aperture_sum
consistent count units
annulus_sum
consistent count units
sky_per_pix_avg
consistent count units (per pixel)
sky_per_pix_med
consistent count units (per pixel)
sky_per_pix_std
consistent count units (per pixel)
aperture_net_cnts
consistent count units
noise_cnts
consistent count units
noise_electrons
u.electron
snr
None
mag_inst
None
mag_error
None
exposure
u.s
date-obs
astropy.time.Time with scale=’utc’
airmass
None
passband
None
file
None
In addition to these required columns, the following columns are created based on the input data during creation.
night
If these computed columns already exist in
dataclass the class will throw an error aValueErrorUNLESSignore_computed=Trueis passed to the initializer, in which case the columns will be retained and not replaced with the computed values.Attributes Summary
The barycentric julian date of the observation.
Descriptor to define a custom attribute for a Table subclass.
Return the coordinates of the stars in the table as a
SkyCoordobject.Instrumental magnitude.
Error in the instrumental magnitude.
Descriptor to define a custom attribute for a Table subclass.
The passband of the observations.
Methods Summary
add_bjd_col([observatory, bjd_coordinates])Returns a astropy column of barycentric Julian date times corresponding to the input observations.
lightcurve_for(target[, flux_column, passband])Return the light curve for a single star as a
lightkurve.LightCurveobject.write_aavso_extended(path, **kwargs)Write this photometry table in the AAVSO Extended File Format.
Attributes Documentation
- bjd#
The barycentric julian date of the observation.
- camera#
Descriptor to define a custom attribute for a Table subclass.
The value of the
TableAttributewill be stored in a dict named__attributes__that is stored in the tablemeta. The attribute can be accessed and set in the usual way, and it can be provided when creating the object.Defining an attribute by this mechanism ensures that it will persist if the table is sliced or serialized, for example as a pickle or ECSV file.
See the
MetaAttributedocumentation for additional details.- Parameters:
- defaultobject
Default value for attribute
Examples
>>> from astropy.table import Table, TableAttribute >>> class MyTable(Table): ... identifier = TableAttribute(default=1) >>> t = MyTable(identifier=10) >>> t.identifier 10 >>> t.meta {'__attributes__': {'identifier': 10}}
- coord#
Return the coordinates of the stars in the table as a
SkyCoordobject. This is computed from the ‘ra’ and ‘dec’ columns in the table.
- mag_inst#
Instrumental magnitude.
- mag_inst_error#
Error in the instrumental magnitude.
- observatory#
Descriptor to define a custom attribute for a Table subclass.
The value of the
TableAttributewill be stored in a dict named__attributes__that is stored in the tablemeta. The attribute can be accessed and set in the usual way, and it can be provided when creating the object.Defining an attribute by this mechanism ensures that it will persist if the table is sliced or serialized, for example as a pickle or ECSV file.
See the
MetaAttributedocumentation for additional details.- Parameters:
- defaultobject
Default value for attribute
Examples
>>> from astropy.table import Table, TableAttribute >>> class MyTable(Table): ... identifier = TableAttribute(default=1) >>> t = MyTable(identifier=10) >>> t.identifier 10 >>> t.meta {'__attributes__': {'identifier': 10}}
- passband#
The passband of the observations.
- phot_descript = {'airmass': None, 'annulus_area': Unit("pix"), 'annulus_inner': Unit("pix"), 'annulus_outer': Unit("pix"), 'annulus_sum': None, 'aperture': Unit("pix"), 'aperture_area': Unit("pix"), 'aperture_net_cnts': None, 'aperture_sum': None, 'date-obs': None, 'dec': Unit("deg"), 'exposure': Unit("s"), 'file': None, 'fwhm_x': Unit("pix"), 'fwhm_y': Unit("pix"), 'mag_error': None, 'mag_inst': None, 'noise_cnts': None, 'noise_electrons': Unit("electron"), 'passband': None, 'ra': Unit("deg"), 'sky_per_pix_avg': None, 'sky_per_pix_med': None, 'sky_per_pix_std': None, 'snr': None, 'star_id': None, 'width': Unit("pix"), 'xcenter': Unit("pix"), 'ycenter': Unit("pix")}#
Methods Documentation
- add_bjd_col(observatory=None, bjd_coordinates=None)[source]#
Returns a astropy column of barycentric Julian date times corresponding to the input observations. It modifies that table in place.
- Parameters:
- observatory: `stellarphot.settings.Observatory`
Information about the observatory. Defaults to the observatory in the table metadata.
- bjd_coordinates: `astropy.coordinates.SkyCoord`, optional (Default: None)
The coordinates to use for computing the BJD. If None, the RA and Dec columns in the table will be used.
- lightcurve_for(target, flux_column='mag_inst', passband=None)[source]#
Return the light curve for a single star as a
lightkurve.LightCurveobject. One of the parametersstar_id,coordinatesornamemust be specified.- Parameters:
- targetstr, int, or
astropy.coordinates.SkyCoord The target star. This can be a star_id, a SkyCoord object, or a name that can be resolved by
astropy.coordinates.SkyCoord.from_name.- flux_columnstr, optional
The name of the column to use as the flux. Default is ‘mag_inst’. This need not actually be a flux.
- passbandstr, optional
The passband to use to generate the lightcurve for. This is only needed if there is more that one passband in the data.
- targetstr, int, or
- Returns:
lightkurve.LightCurveThe light curve for the star. This includes all of the columns in the
stellarphot.`PhotometryDataobject and columnstime,flux, andflux_err.
- write_aavso_extended(path, **kwargs)[source]#
Write this photometry table in the AAVSO Extended File Format.
See
stellarphot.io.write_aavso_extendedfor the full signature and behavior. All keyword arguments are forwarded to that function.