dm-dt API
light_curve.DmDt
dm-dt map producer
Each pair of observations is mapped to dm-dt plane bringing unity value. dmdt-map is a rectangle
on this plane consisted of dt_size x dm_size cells, and limited by [min_dt; max_dt) and
[min_dm; max_dm) intervals. .points*() methods assigns unity value of each observation to a
single cell, while .gausses*() methods smears this unity value over all cells with given dt
value using normal distribution N(m2 - m1, sigma1^2 + sigma2^2), where (t1, m1, sigma1) and
(t2, m2, sigma2) are a pair of observations including uncertainties. Optionally, after the map
is built, normalisation is performed ("norm" parameter): "dt" means divide each dt = const
column by the total number of all observations corresponded to given dt (in this case
gausses() output can be interpreted as conditional probability p(dm|dt)); "max" means divide
all values by the maximum value; both options can be combined, then "max" is performed after
"dt".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
np.array of float64
|
Ascending array of dt grid edges |
required |
dm
|
np.array of float64
|
Ascending array of dm grid edges |
required |
dt_type
|
str
|
Type of |
required |
dm_type
|
str
|
Type of |
required |
norm
|
list of str
|
Types of normalisation, cab be any combination of "dt" and "max",
default is an empty list |
required |
n_jobs
|
int
|
Number of parallel threads to run bulk methods such as |
required |
approx_erf
|
bool
|
Use approximation normal CDF in |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
n_jobs |
int
|
|
shape |
(int, int)
|
Shape of a single dmdt map, |
dt_grid |
np.array of float64
|
|
min_dt |
float
|
|
max_dt |
float
|
|
dm_grid |
np.array of float64
|
|
min_dm |
float
|
|
max_dm |
float
|
|
Methods:
| Name | Description |
|---|---|
from_borders |
Construct |
points |
Produces dmdt-maps from light curve |
gausses |
Produces smeared dmdt-map from noisy light curve |
count_dt |
Total number of observations per each dt interval |
points_many |
Produces dmdt-maps from a list of light curves |
gausses_many |
Produces smeared dmdt-maps from a list of light curves |
count_dt_many |
Number of observations in each dt for a list of arrays |
points_batches |
Gives a reusable iterable which yields dmdt-maps |
gausses_batches |
Gives a reusable iterable which yields smeared dmdt-maps |
dm_grid
property
dt_grid
property
max_dm
property
max_dt
property
min_dm
property
min_dt
property
n_jobs
property
shape
property
count_dt
method descriptor
Total number of observations per each dt interval
Output takes into account all observation pairs within [min_dt; max_dt), even if they are not in [min_dm; max_dm)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
1d-ndarray of float
|
Time moments, must be sorted |
required |
sorted
|
bool or None
|
|
None
|
cast
|
bool
|
If |
False
|
Returns
|
|
required |
count_dt_many
method descriptor
Total number of observations per each dt interval
Output takes into account all observation pairs within [min_dt; max_dt), even if they are not in [min_dm; max_dm)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_
|
list of 1d-ndarray of float
|
List of arrays, each represents time moments, must be sorted |
required |
sorted
|
bool or None
|
|
None
|
Returns
|
|
required |
gausses
method descriptor
Produces smeared dmdt-map from light curve
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
1d-ndarray of float
|
Time moments, must be sorted |
required |
m
|
1d-ndarray of float
|
Magnitudes |
required |
sigma
|
1d-ndarray of float
|
Uncertainties |
required |
sorted
|
bool or None
|
|
None
|
cast
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
2d-array of float
|
|
gausses_batches
method descriptor
Reusable iterable yielding dmdt-maps
The dmdt-maps are produced in parallel using n_jobs threads, batches
are being generated in background, so the next batch is started to
generate just after the previous one is yielded. Note that light curves
data are copied, so from the performance point of view it is better to
use gausses_many if you don't need observation dropping
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lcs
|
list of (ndarray, ndarray, ndarray)
|
List or tuple of tuple pairs (t, m, sigma) represented individual light curves. All arrays must have the same dtype |
required |
sorted
|
bool or None
|
|
None
|
batch_size
|
int
|
The number of dmdt-maps to yield. The last batch can be smaller. Default is 1 |
1
|
yield_index
|
bool
|
Yield a tuple of (indexes, maps) instead of just maps. Could be
useful when shuffle is |
False
|
shuffle
|
bool
|
If |
False
|
drop_nobs
|
int or float
|
Drop observations from every light curve. If it is a positive
integer, it is a number of observations to drop. If it is a
floating point between 0 and 1, it is a part of observation to
drop. Default is |
0
|
random_seed
|
int or None
|
Random seed for shuffling and dropping. Default is |
None
|
gausses_many
method descriptor
Produces smeared dmdt-map from a collection of light curves
The method is performed in parallel using n_jobs threads
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lcs
|
list of (ndarray, ndarray, ndarray)
|
List or tuple of tuple pairs (t, m, sigma) represented individual light curves. All arrays must have the same dtype |
required |
sorted
|
bool or None
|
|
None
|
Returns:
| Type | Description |
|---|---|
3d-ndarray of float
|
|
points
method descriptor
Produces dmdt-map from light curve
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
1d-ndarray of float
|
Time moments, must be sorted |
required |
m
|
1d-ndarray of float
|
Magnitudes |
required |
sorted
|
bool or None
|
|
None
|
cast
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
2d-ndarray of float
|
|
points_batches
method descriptor
Reusable iterable yielding dmdt-maps
The dmdt-maps are produced in parallel using n_jobs threads, batches
are being generated in background, so the next batch is started to
generate just after the previous one is yielded. Note that light curves
data are copied, so from the performance point of view it is better to
use points_many if you don't need observation dropping
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lcs
|
list of (ndarray, ndarray)
|
List or tuple of tuple pairs (t, m) represented individual light curves. All arrays must have the same dtype |
required |
sorted
|
bool or None
|
|
None
|
batch_size
|
int
|
The number of dmdt-maps to yield. The last batch can be smaller. Default is 1 |
1
|
yield_index
|
bool
|
Yield a tuple of (indexes, maps) instead of just maps. Could be
useful when shuffle is |
False
|
shuffle
|
bool
|
If |
False
|
drop_nobs
|
int or float
|
Drop observations from every light curve. If it is a positive
integer, it is a number of observations to drop. If it is a
floating point between 0 and 1, it is a part of observation to
drop. Default is |
0
|
random_seed
|
int or None
|
Random seed for shuffling and dropping. Default is |
None
|
Returns:
| Type | Description |
|---|---|
Iterable of 3d-ndarray or (1d-ndarray, 3d-ndarray)
|
|
points_many
method descriptor
Produces dmdt-map from a collection of light curves
The method is performed in parallel using n_jobs threads
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lcs
|
list of (ndarray, ndarray)
|
List or tuple of tuple pairs (t, m) represented individual light curves. All arrays must have the same dtype |
required |
sorted
|
bool or None
|
|
None
|
Returns:
| Type | Description |
|---|---|
3d-ndarray of float
|
|