PhotometrySelector

class daschlab.photometry.PhotometrySelector(phot: Photometry, apply)[source]

Bases: object

A helper object that supports Photometry filtering functionality.

Photometry selector objects are returned by photometry selection “action verbs” such as Photometry.keep_only. Calling one of the methods on a selector instance will apply the associated action to the specified portion of the photometry data.

Attributes Summary

not_

Get a selector that will act on an inverted row selection.

Methods Summary

any_aflags(aflags, **kwargs)

Act on rows that have any of the specific AFLAGS bits set.

any_bflags(bflags, **kwargs)

Act on rows that have any of the specific BFLAGS bits set.

brighter(cutoff_mag, **kwargs)

Act on detections brighter than the specified cutoff magnitude.

detected(**kwargs)

Act on rows corresponding to detections.

detected_and_fainter(cutoff_mag, **kwargs)

Act on detections fainter than the specified cutoff magnitude.

exposure_linked(**kwargs)

Act on rows that have been successfully linked to rows in the Exposures table.

local_id(local_id, **kwargs)

Act on the row with the specified local ID.

meteor(**kwargs)

Act on rows associated with ultra-low-resolution "meteor" telescopes.

narrow(**kwargs)

Act on rows associated with narrow-field telescopes.

nonrej_detected(**kwargs)

Act on rows that are non-rejected detections.

patrol(**kwargs)

Act on rows associated with low-resolution "patrol" telescopes.

rejected(**kwargs)

Act on rows with a non-zero "reject" value.

rejected_with(tag[, strict])

Act on rows that have been rejected with the specified tag.

series(series, **kwargs)

Act on rows associated with the specified plate series.

undetected(**kwargs)

Act on rows corresponding to nondetections.

where(row_mask, **kwargs)

Act on exactly the specified list of rows.

Attributes Documentation

not_

Get a selector that will act on an inverted row selection.

Examples

Create a lightcurve subset containing nondetections and detections that are not within 10 arcsec of the mean source position:

from astropy import units as u

lc = sess.lightcurve(some_local_id)
far = lc.keep_only.not_.sep_below(10 * u.arcsec)

In general, the function of this modifier is such that:

lc.ACTION.not_.CONDITION()
# should be equivalent to:
lc.ACTION.where(~lc.match.CONDITION())

The logical negation implied by this method can cause problems if your photometry contains nondetections. For instance, the above logic will select both detections with measured separations above 10 arcsec, and nondetections where the separation is undefined. If you are using this selection to reject data points, the latter aspect may be undesirable.

Methods Documentation

any_aflags(aflags: int, **kwargs) Photometry[source]

Act on rows that have any of the specific AFLAGS bits set.

Parameters:
aflagsint or AFlags

The flag or flags to check for. If this value contains multiple non-zero bits, a row will be selected if its AFLAGS contain any of the specified bits.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only rows with the specified flags:

from astropy import units as u
from daschlab.photometry import AFlags

lc = sess.lightcurve(some_local_id)
filter = AFlags.LARGE_DRAD | AFlags.RADIAL_BIN_9
bad = lc.keep_only.any_aflags(filter)
any_bflags(bflags: int, **kwargs) Photometry[source]

Act on rows that have any of the specific BFLAGS bits set.

Parameters:
bflagsint or BFlags

The flag or flags to check for. If this value contains multiple non-zero bits, a row will be selected if its BFLAGS contain any of the specified bits.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only rows with the specified flags:

from astropy import units as u
from daschlab.photometry import BFlags

lc = sess.lightcurve(some_local_id)
filter = BFlags.EXTINCTION_CAL_APPLIED | BFlags.MAG_DEP_CAL_APPLIED
full_cal = lc.keep_only.any_bflags(filter)
brighter(cutoff_mag: float, **kwargs) Photometry[source]

Act on detections brighter than the specified cutoff magnitude.

Parameters:
cutoff_magfloat

The cutoff magnitude.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Notes

The cutoff is exclusive, i.e., the comparison is perform with a less-than rather than less-than-or-equals comparison.

Examples

Create a lightcurve subset containing only points brighter than 13th magnitude:

lc = sess.lightcurve(some_local_id)
bright = lc.keep_only.brighter(13)
detected(**kwargs) Photometry[source]

Act on rows corresponding to detections.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only detections:

lc = sess.lightcurve(some_local_id)
detns = lc.keep_only.detected()
detected_and_fainter(cutoff_mag: float, **kwargs) Photometry[source]

Act on detections fainter than the specified cutoff magnitude.

Parameters:
cutoff_magfloat

The cutoff magnitude.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Notes

The cutoff is exclusive, i.e., the comparison is perform with a greater-than rather than greater-than-or-equals comparison.

Examples

Create a lightcurve subset containing only points fainter than 13th magnitude:

lc = sess.lightcurve(some_local_id)
faint = lc.keep_only.detected_and_fainter(13)
exposure_linked(**kwargs) Photometry[source]

Act on rows that have been successfully linked to rows in the Exposures table.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Notes

In principle, every DASCH photometric point should be able to be successfully linked to an exposure in the exposures table. Sometimes, however, data issues prevent this from happening. In order to reliably copy columns from the exposures table to a lightcurve as in the example above, make sure that you remove non-linked columns first.

Examples

Create a lightcurve subset containing only rows that have successfully linked to exposures, and then copy over APASS colorterm data:

lc = sess.lightcurve(some_local_id)
ellc = lc.keep_only.exposure_linked()
ellc["ct_apass"] = sess.exposures()["median_colorterm_apass"][ellc["exp_local_id"]]
local_id(local_id: int, **kwargs) Photometry[source]

Act on the row with the specified local ID.

Parameters:
local_idint

The local ID to select.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Notes

Photometry point local IDs are unique, and so this filter should only ever match at most one row.

Examples

Create a lightcurve subset containing only the chronologically first row:

lc = sess.lightcurve(some_local_id)
first = lc.keep_only.local_id(0)
meteor(**kwargs) Photometry[source]

Act on rows associated with ultra-low-resolution “meteor” telescopes.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only points from meteor telescopes:

lc = sess.lightcurve(some_local_id)
meteor = lc.keep_only.meteor()
narrow(**kwargs) Photometry[source]

Act on rows associated with narrow-field telescopes.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only points from narrow-field telescopes:

lc = sess.lightcurve(some_local_id)
narrow = lc.keep_only.narrow()
nonrej_detected(**kwargs) Photometry[source]

Act on rows that are non-rejected detections.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Notes

This selector is a shorthand combination of PhotometrySelector.detected() and (a logical inversion of) PhotometrySelector.rejected().

Examples

Create a lightcurve subset containing only non-rejected detections:

lc = sess.lightcurve(some_local_id)
good = lc.keep_only.nonrej_detected()
patrol(**kwargs) Photometry[source]

Act on rows associated with low-resolution “patrol” telescopes.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only points from patrol telescopes:

lc = sess.lightcurve(some_local_id)
patrol = lc.keep_only.patrol()
rejected(**kwargs) Photometry[source]

Act on rows with a non-zero "reject" value.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only rejected rows:

lc = sess.lightcurve(some_local_id)
rejects = lc.keep_only.rejected()
rejected_with(tag: str, strict: bool = False, **kwargs) Photometry[source]

Act on rows that have been rejected with the specified tag.

Parameters:
tagstr

The tag used to identify the rejection reason

strictoptional bool, default False

If true, and the specified tag has not been defined, raise an exception. Otherwise, the action will be invoked with no rows selected.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only rows rejected with the “astrom” tag:

lc = sess.lightcurve(some_local_id) astrom_rejects = lc.keep_only.rejected_with(“astrom”)

series(series: str, **kwargs) Photometry[source]

Act on rows associated with the specified plate series.

Parameters:
seriesstr

The plate series to select.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only points from the MC series:

lc = sess.lightcurve(some_local_id)
mcs = lc.keep_only.series("mc")
undetected(**kwargs) Photometry[source]

Act on rows corresponding to nondetections.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only nondetections:

lc = sess.lightcurve(some_local_id)
nondetns = lc.keep_only.undetected()
where(row_mask: ndarray, **kwargs) Photometry[source]

Act on exactly the specified list of rows.

Parameters:
row_maskboolean numpy.ndarray

A boolean array of exactly the size of the input photometry, with true values indicating rows that should be acted upon.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Photometry

However, different actions may return different types. For instance, the Photometry.count action will return an integer.

Examples

Create a lightcurve subset containing only points that are from A-series plates with detections brighter than 13th magnitude:

lc = sess.lightcurve(some_local_id)
subset = lc.keep_only.where(
    lc.match.series("a") & lc.match.brighter(13)
)