Photometry¶
- class daschlab.photometry.Photometry(data=None, masked=False, names=None, dtype=None, meta=None, copy=True, rows=None, copy_indices=True, units=None, descriptions=None, **kwargs)[source]¶
Bases:
Table
A DASCH photometry data table.
Photometry
is a subclass ofastropy.table.Table
. You will in turn almost always deal with DASCH photometry using one of two more specialized subclasses:Lightcurve
for lightcurves (the same source over time) orExtract
for “extracts” (a bunch of sources from the same exposure).This class defines methods that apply to either of these use cases. You can also use all of the usual methods and properties made available by the
astropy.table.Table
class. Items provided by those classes are not documented here.The actual data contained in these tables — the columns — are documented elsewhere, on the main DASCH website.
You should not construct
Photometry
instances directly. Instead, obtain lightcurves using thedaschlab.Session.lightcurve()
method.See the lightcurve module-level documentation for a summary of the filtering and subsetting functionality provided by these classes.
Cheat sheet:
time
is HJD midpointmagcal_magdep
is preferred calibrated phot measurementlegacy plotter error bar is
magcal_local_rms` * `error_bar_factor
, the latter being set to match the error bars to the empirical RMS, if this would shrink the error bars
Attributes Summary
An action returning the number of selected rows
An action returning a
Photometry
copy dropping the selected rows; all non-selected rows are retained.An action returning a
Photometry
copy containing only the selected rows.An action returning a boolean array identifying selected rows.
An action modifying the photometry in-place, rejecting the selected rows.
An action modifying the photometry in-place, rejecting rows not matching the selection.
An action returning two
Photometry
copies, partitioning by the selection.Methods Summary
Apply a standard set of data-quality rejections to the photometry.
export
(path[, format, drop_rejects])Save a copy of this photometry to a file.
scatter
(x_axis, y_axis[, rejects])Make a Bokeh scatter plot of photometry data.
summary
()Print a brief textual summary of the photometry contents.
Attributes Documentation
- count¶
An action returning the number of selected rows
Unlike many actions, this returns an
int
, not a newPhotometry
- drop¶
An action returning a
Photometry
copy dropping the selected rows; all non-selected rows are retained.
- keep_only¶
An action returning a
Photometry
copy containing only the selected rows.
- match¶
An action returning a boolean array identifying selected rows.
Unlike many actions, this does not return a new
Photometry
. It can be used to implement arbitrary boolean logic within the action/selection framework:lc = sess.lightcurve(some_local_id) subset = lc.keep_only.where( lc.match.series("a") & lc.match.brighter(13) )
- reject¶
An action modifying the photometry in-place, rejecting the selected rows.
Usage is as follows:
lc = sess.lightcurve(some_local_id) # Mark all points from meteor telescopes as rejected: lc.reject.meteor(tag="meteor")
The
tag
keyword argument to the selector is mandatory. It specifies a short, arbitrary “tag” documenting the reason for rejection. Each unique tag is associated with a binary bit of the"reject"
column, and these bits are logically OR’ed together as rejections are established. The maximum number of distinct rejection tags is 64, since the"reject"
column is stored as a 64-bit integer.If a
verbose
keyword argument is true (the default), a message will be printed summarizing the number of rejected rows. If false, nothing will be printed.If a
dry_run
keyword argument is true (not the default), the"reject"
column will not actually be modified. Instead, a message about what would have changed is printed.
- reject_unless¶
An action modifying the photometry in-place, rejecting rows not matching the selection.
Usage is as follows:
lc = sess.lightcurve(some_local_id) # Mark all points *not* from narrow-field telescopes as rejected: lc.reject_unless.narrow(tag="lowrez") # This is equivalent to: lc.reject.not_.narrow(tag="lowrez")
The
tag
keyword argument to the selector is mandatory. It specifies a short, arbitrary “tag” documenting the reason for rejection. Each unique tag is associated with a binary bit of the"reject"
column, and these bits are logically OR’ed together as rejections are established. The maximum number of distinct rejection tags is 64, since the"reject"
column is stored as a 64-bit integer.The logical negation used by this function can cause problems if your photometry contains nondetections. For instance, if you intend to reject points unless they are brighter than a mag of 15.0, you will also reject all of the nondetections, even shallow upper limits consistent with that cutoff.
- split_by¶
An action returning two
Photometry
copies, partitioning by the selection.Unlike many actions, this returns a tuple of two new
Photometry
instances, not just one. The first returned instance contains only the selected points; the second instance returns all others. This can be useful for statistical comparisons:from astropy import units as u lc = sess.lightcurve(some_local_id) neardet, fardet = lc.keep_only.nonrej_detected().split_by.sep_below(20 * u.arcsec) near_std = neardet["magcal_magdep"].std() far_std = neardet["magcal_magdep"].std()
Methods Documentation
- apply_standard_rejections()[source]¶
Apply a standard set of data-quality rejections to the photometry.
Warning: this function is in development. Do not rely on it to fully clean your data.
Notes
Until this functionality is more settled, the rejections will not be documented here. See the source code to see what it does.
- export(path: str, format: str = 'csv', drop_rejects: bool = True)[source]¶
Save a copy of this photometry to a file.
- Parameters:
- path
str
The path at which the exported photometric data will be saved.
- format
str
, default"csv"
The file format in which to save the data. Currently, the only allowed value is
"csv"
.- drop_rejects
bool
, defaultTrue
If True, rejected points will not appear in the output file at all. Otherwise, they will be included, and there will be a
"reject"
column reproducing their rejection status.
- path
Notes
The default
"csv"
output format only exports a subset of the table columns known as the “medium” subset. It is defined in the lightcurve table documentation.
- scatter(x_axis: str, y_axis: str, rejects: bool = False) figure [source]¶
Make a Bokeh scatter plot of photometry data.
- Parameters:
- Returns:
bokeh.plotting.figure
A plot.
Notes
The function
bokeh.io.show
(imported asbokeh.plotting.show
) is called on the figure before it is returned, so you don’t need to do that yourself.