punchbowl.level3.f_corona_model#
Functions#
|
Fast solver for the quadratic programming problem. |
|
Model the F corona given a list of times and a corresponding data cube. |
|
Model the F corona given a list of times and a corresponding data cube. |
|
|
|
Fill NaN values in an image using interpolation. |
|
|
|
Construct a full F corona model. |
|
Subtract f corona background. |
|
Subtracts a background f corona model from an observation. |
|
Create an empty background model. |
Module Contents#
- punchbowl.level3.f_corona_model.solve_qp_cube(input_vals: numpy.ndarray, cube: numpy.ndarray, n_nonnan_required: int = 7)[source]#
Fast solver for the quadratic programming problem.
- Parameters:
input_vals (np.ndarray) – array of times
cube (np.ndarray) – array of data
n_nonnan_required (int) – The number of non-nan values that must be present in each pixel’s time series. Any pixels with fewer will not be fit, with zeros returned instead.
- Returns:
Array of coefficients for solving polynomial
- Return type:
np.ndarray
- punchbowl.level3.f_corona_model.model_fcorona_for_cube_real(xt: numpy.ndarray, reference_xt: float, cube: numpy.ndarray, min_brightness: float = 1e-18, clip_factor: float | None = 1, return_full_curves: bool = False, num_workers: int | None = 8, detrend: bool = True) tuple[numpy.ndarray, numpy.ndarray] | tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]#
Model the F corona given a list of times and a corresponding data cube.
- Parameters:
xt (np.ndarray) – time array
reference_xt (float) – timestamp to evaluate the model for
cube (np.ndarray) – observation array
min_brightness (float) – pixels dimmer than this value are set to nan and considered empty
clip_factor (float | None) – If None, no smoothing is applied. Otherwise, the difference between the 25th and 75th percentile is computed and values that vary from the median by more than clip_factor times the difference data are rejected.
return_full_curves (bool) – If True, this function returns the full curve fitted to the time series at each pixel and the smoothed data cube. If False (default), only the curve’s value at the central frame is returned, producing a model at one instant in time.
num_workers (int | None) – Work is parallelized over this many worker processes. If None, this matches the number of cores.
detrend (bool) – Whether to detrend each time series before outlier rejection
- Returns:
np.ndarray – The F-corona model at the central point in time. If return_full_curves is True, this is instead the F-corona model at all points in time covered by the data cube
np.ndarray – The number of data points used in solving the F-corona model for each pixel of the output
np.ndarray – The smoothed data cube. Returned only if return_full_curves is True.
- punchbowl.level3.f_corona_model.model_fcorona_for_cube(cube: numpy.ndarray) numpy.ndarray[source]#
Model the F corona given a list of times and a corresponding data cube.
- Parameters:
xt (np.ndarray) – Unused
reference_xt (float) – Unused
cube (np.ndarray) – observation array
args (list) – Kept for signature compatibility
kwargs (dict) – Kept for signature compatibility
- Returns:
np.ndarray – The F-corona model at the central point in time. If return_full_curves is True, this is instead the F-corona model at all points in time covered by the data cube
None – Nothing
- punchbowl.level3.f_corona_model._model_fcorona_for_cube_inner(xt: numpy.ndarray, reference_xt: float, cube: numpy.ndarray, min_brightness: float = 1e-18, clip_factor: float | None = 1, return_full_curves: bool = False, detrend: bool = True) tuple[numpy.ndarray, numpy.ndarray] | tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]#
- punchbowl.level3.f_corona_model.fill_nans_with_interpolation(image: numpy.ndarray) numpy.ndarray[source]#
Fill NaN values in an image using interpolation.
- punchbowl.level3.f_corona_model._load_file(path: str, data_destination: punchbowl.util.ShmPickleableNDArray) tuple[numpy.ndarray, datetime.datetime, str][source]#
- punchbowl.level3.f_corona_model.construct_f_corona_model(filenames: list[str], reference_time: str | None = None, num_workers: int = 8, num_loaders: int | None = None, fill_nans: bool = False, polarized: bool = False) list[ndcube.NDCube][source]#
Construct a full F corona model.
- punchbowl.level3.f_corona_model.subtract_f_corona_background(data_object: ndcube.NDCube, before_f_background_model: ndcube.NDCube, after_f_background_model: ndcube.NDCube, allow_extrapolation: bool = False) ndcube.NDCube[source]#
Subtract f corona background.
- punchbowl.level3.f_corona_model.subtract_f_corona_background_task(observation: ndcube.NDCube, before_f_background_models: list[ndcube.NDCube | str], after_f_background_models: list[ndcube.NDCube | str], allow_extrapolation: bool = False) ndcube.NDCube[source]#
Subtracts a background f corona model from an observation.
This algorithm linearly interpolates between the before and after models.
- Parameters:
observation (NDCube) – an observation to subtract an f corona model from
before_f_background_models (list[NDCube | str]) – NDCube f corona background maps before the observations
after_f_background_models (list[NDCube | str]) – NDCube f corona background maps after the observations
allow_extrapolation (bool) – If true, allow extrapolation beyond the time range spanned by the two F corona models
- Returns:
A background subtracted data frame
- Return type:
NDCube