edges_analysis.filters.lst_model.get_gha_model_filter

edges_analysis.filters.lst_model.get_gha_model_filter(data: ~typing.Sequence[str | ~pathlib.Path | ~edges_analysis.gsdata.gsdata.GSData], aggregator: ~edges_analysis.filters.lst_model.FrequencyAggregator, metric_model: ~edges_cal.modelling.Model, std_model: ~edges_cal.modelling.Model, detrend_metric_model: ~edges_cal.modelling.Model | None = None, detrend_std_model: ~edges_cal.modelling.Model | None = None, detrend_gha_chunk_size: ~astropy.units.quantity.Quantity = <Quantity 24. hourangle>, n_resid: int = 1, **kwargs) tuple[GHAModelFilter, GHAModelFilterInfo][source]

Obtain a filtering object from a given set of representative data.

The algorithm here is to first intrinsically flag the input data, then fit a model to it over GHA, which can be used to flag further files. The initial intrinsice flagging is by default done with the same model that will be applied to other data, but it can be done at a more fine-grained level, fitting to small chunks of GHA at a time with a lower-order model.

Parameters:
  • data – A sequence of data files to use to obtain the metric over which to filter.

  • aggregator – A specialized function that takes a file and some parameters and returns an aggregated metric.

  • metric_model – A linear model to be fit to the aggregated metric data.

  • std_model – A linear model to be fit to the absolute residuals of the metric data.

  • metric_model_kwargs – Parameters for the linear model (such as n_terms) to fit to the metric.

  • std_model_kwargs – Parameters for the linear model (such as n_terms) to fit to the std.

  • detrend_metric_model – A model to fit to the data to detrend it in order to determine flags. This is a model instance, but it should not have the default_x set on it. By default, the same as metric_model_type (with the same parameters).

  • detrend_std_model – A model to fit to the residuals of the data in order to determine flags. This is a model instance, but it should not have the default_x set on it. By default, the same as std_model_type (with the same parameters).

  • detrend_gha_chunk_size – The chunk size (in GHA) to use for model-fitting, in order to detrend and find flags in the input data. By default, use the whole data set to find flags.

  • **kwargs – All other arguments passed to edges_cal.xrfi.model_filter()

Returns:

  • filter – An object that can be used to filter other files based on the same aggregation.

  • info – An object containing information about the fit itself – useful for inspection.