LightcurveSelector

class daschlab.lightcurves.LightcurveSelector(lc: Lightcurve, apply)[source]

Bases: object

A helper object that supports Lightcurve filtering functionality.

Lightcurve selector objects are returned by lightcurve selection “action verbs” such as Lightcurve.keep_only. Calling one of the methods on a selector instance will apply the associated action to the specified portion of the lightcurve 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.

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.

sep_above([sep_limit, pos])

Act on rows whose positional separations from the source location are above the limit.

sep_below([sep_limit, pos])

Act on rows whose positional separations from the source location are below the limit.

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 lightcurve 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) Lightcurve[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 Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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.lightcurves 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) Lightcurve[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 Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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.lightcurves 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) Lightcurve[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 Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[source]

Act on rows corresponding to detections.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[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 Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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)
local_id(local_id: int, **kwargs) Lightcurve[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 Lightcurve

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

Notes

Lightcurve 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) Lightcurve[source]

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

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[source]

Act on rows associated with narrow-field telescopes.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[source]

Act on rows that are non-rejected detections.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

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

Notes

This selector is a shorthand combination of LightcurveSelector.detected() and (a logical inversion of) LightcurveSelector.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) Lightcurve[source]

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

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[source]

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

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[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 Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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”)

sep_above(sep_limit: ~astropy.units.quantity.Quantity = <Quantity 20. arcsec>, pos: ~astropy.coordinates.sky_coordinate.SkyCoord | None = None, **kwargs) Lightcurve[source]

Act on rows whose positional separations from the source location are above the limit.

Parameters:
sep_limitoptional astropy.units.Quantity, default 20 arcsec

The separation limit. This should be an angular quantity.

posoptional astropy.coordinates.SkyCoord or None

The position relative to which the separation is computed. If unspecified, the lightcurve mean_pos() is used.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

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

Notes

Nondetection rows do not have an associated position, and will never match this filter.

Examples

Create a lightcurve subset containing only detections beyond 10 arcsec from the mean source position:

from astropy import units as u

lc = sess.lightcurve(some_local_id)
near = lc.keep_only.sep_above(10 * u.arcsec)
sep_below(sep_limit: ~astropy.units.quantity.Quantity = <Quantity 20. arcsec>, pos: ~astropy.coordinates.sky_coordinate.SkyCoord | None = None, **kwargs) Lightcurve[source]

Act on rows whose positional separations from the source location are below the limit.

Parameters:
sep_limitoptional astropy.units.Quantity, default 20 arcsec

The separation limit. This should be an angular quantity.

posoptional astropy.coordinates.SkyCoord or None

The position relative to which the separation is computed. If unspecified, the lightcurve mean_pos() is used.

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

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

Notes

Nondetection rows do not have an associated position, and will never match this filter.

Examples

Create a lightcurve subset containing only detections within 10 arcsec of the mean source position:

from astropy import units as u

lc = sess.lightcurve(some_local_id)
near = lc.keep_only.sep_below(10 * u.arcsec)
series(series: str, **kwargs) Lightcurve[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 Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[source]

Act on rows corresponding to nondetections.

Parameters:
**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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) Lightcurve[source]

Act on exactly the specified list of rows.

Parameters:
row_maskboolean numpy.ndarray

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

**kwargs

Parameters forwarded to the action.

Returns:
Usually, another Lightcurve

However, different actions may return different types. For instance, the Lightcurve.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)
)