5. API reference
5.1. deep_transit
- class deep_transit.DeepTransit(lc_object=None, time=None, flux=None, flux_err=None, is_flat=False, lk_kwargs={}, flatten_kwargs={})[source]
The core class of transit detection.
- __init__(lc_object=None, time=None, flux=None, flux_err=None, is_flat=False, lk_kwargs={}, flatten_kwargs={})[source]
Initial function for receiving an light curve object or a time series.
- Parameters
lc_object (
LightCurveinstance) – Input light curve objecttime (
Timeor iterable) – Time values. They can either be given directly as aTimearray or as any iterable that initializes theTimeclass.flux (
Quantityor iterable) – Flux values for every time point.flux_err (
Quantityor iterable) – Uncertainty on each flux data point.is_flat (bool) – True when receiving a flattened light, False will use the built-in flatten method.
lk_kwargs (dict) – Keyword arguments of
LightCurve.flatten_kwargs (dict) – Keyword arguments of
detrend_light_curvemethod.
- transit_detection(local_model_path, batch_size=2, confidence_threshold=0.6, nms_iou_threshold=0.1, device_str='auto', backend='pytorch')[source]
Searching transit signals from a given light curve.
- Parameters
model_path (str) – The path of the model file.
batch_size (int) – Batch size for increasing detection speed, especially useful for GPU default value is 2, if using GPU, it can be higher depending on the limitation of the GPU memory.
confidence_threshold (float) – Confidence threshold for transit detection. If None, the value will be obtained from config. Default value is 0.6.
nms_iou_threshold (float) – IOU threshold for NMS algorithm. If None, the value will be obtained from config. Default value is 0.1.
device_str (str) – Device name. If “cuda”, it will use GPU. Default is “auto”.
backend (str) – Backend of the model. You can choose between “pytorch” or “megengine”. Default is “pytorch”.
- Returns
final_bboxes – An (N, 5) shape numpy.ndarray of bounding boxes.
- Return type
np.ndarray
- deep_transit.detrend_light_curve(lc_object, window_length=0.5, edge_cutoff=0.5, break_tolerance=0.5, cval=5.0, sigma_upper=3, sigma_lower=20)[source]
Detrend a light curve for upcoming transit searching with wotan biweight method and sigma clipping https://github.com/hippke/wotan
- Parameters
lc_object (
LightCurveinstance) – Input light curve objectwindow_length (float) – The length of the filter window in units of
time, default is 0.5edge_cutoff (float) – Length (in units of time) to be cut off each edge, default is 0.5
break_tolerance (float) – Split into segments at breaks longer than that, default is 0.5
cval (float) – Tuning parameter for the robust estimators, default is 5.0
sigma_upper (float) – Upper limit of standard deviations for sigma clipping
sigma_lower (float) – Lower limit of standard deviations for sigma clipping
- Returns
flatten_lc
- Return type
LightCurveinstance
- deep_transit.plot_lc_with_bboxes(lc_object, bboxes, ax=None, **kwargs)[source]
Plot light curve with bounding boxes
- Parameters
lc_object (
LightCurveinstance) –bboxes (list or np.ndarray) – Bounding boxes in shape (N, 5)
ax (
axisinstance) – Axis to plot to. If None, create a new one.kwargs (dict) – Additional arguments to be passed to
matplotlib.pyplot.plot
- Returns
ax – The matplotlib axes object.
- Return type
axisinstance
5.2. deep_transit.config
- deep_transit.config.IMAGE_SIZE = 416
Image size of you training data set, should be the multiples of 32
- Type
- deep_transit.config.LEARNING_RATE = 0.0001
Learning rate parameter of the Adam optimization
- Type
- deep_transit.config.WEIGHT_DECAY = 0.0001
Weight decay parameter of the Adam optimization
- Type
- deep_transit.config.CONF_THRESHOLD = 0.6
The confidence threshold for validation and detection. The number should be 0 to 1, it can be a represent of S/N
- Type
- deep_transit.config.PIN_MEMORY = True
bool:
- deep_transit.config.LOAD_MODEL = False
If true, it will require loading a previous checkpoint before training
- Type
- deep_transit.config.SAVE_MODEL = False
If true, it will save model during the training step
- Type
- deep_transit.config.ENABLE_AMP = True
If true, AMP (automatic mixed precision) will be enabled. Note: if AMD CPU, the ENABLE_AMP should be False.
- Type
- deep_transit.config.ENABLE_WANDB = False
If true, a Weights & Biases offline stroage will be enabled
- Type
5.3. deep_transit.train
- deep_transit.train(patience=2, cooldown=3, enable_seed_everything=True)[source]
Function for training your own data set.
- Parameters
patience (int) – The parameter of
ReduceLROnPlateaucooldown (int) – The parameter of
ReduceLROnPlateauenable_seed_everything (bool) – If true, the training will be deterministic