remove_lytaf_events_from_timeseries

sunpy.instr.lyra.remove_lytaf_events_from_timeseries(ts, artifacts=None, return_artifacts=False, lytaf_path=None, force_use_local_lytaf=False)[source] [edit on github]

Removes periods of LYRA artifacts defined in LYTAF from a TimeSeries.

Parameters:
  • ts (sunpy.timeseries.TimeSeries) –
  • artifacts (list of strings) – Sets the artifact types to be removed. For a list of artifact types see reference [1]. For example, if a user wants to remove only large angle rotations, listed at reference [1] as LAR, set artifacts=[“LAR”]. The default is that no artifacts will be removed.
  • return_artifacts (bool) – Set to True to return a numpy.recarray containing the start time, end time and type of all artifacts removed. Default=False
  • lytaf_path (str) – directory path where the LYRA annotation files are stored.
  • force_use_local_lytaf (bool) – Ensures current local version of lytaf files are not replaced by up-to-date online versions even if current local lytaf files do not cover entire input time range etc. Default=False
Returns:

  • ts_new (sunpy.timeseries.TimeSeries) – copy of input TimeSeries with periods corresponding to artifacts removed.
  • artifact_status (dict) – List of 4 variables containing information on what artifacts were found, removed, etc. from the time series. | artifact_status[“lytaf”] : numpy.recarray | The full LYRA annotation file for the time series time range | output by get_lytaf_events(). | artifact_status[“removed”] : numpy.recarray | Artifacts which were found and removed from from time series. | artifact_status[“not_removed”] : numpy.recarray | Artifacts which were found but not removed as they were not | included when user defined artifacts kwarg. | artifact_status[“not_found”] : list of strings | Artifacts listed to be removed by user when defining | artifacts kwarg which were not found in time series time range.

Notes

This function is intended to take TimeSeries objects as input, but the deprecated LightCurve is still supported here.

References

[1] http://proba2.oma.be/data/TARDIS

Examples

Remove LARs (Large Angle Rotations) from TimeSeries for 4-Dec-2014:

>>> import sunpy.timeseries as ts
>>> import sunpy.data.sample  # doctest: +REMOTE_DATA
>>> from sunpy.instr.lyra import remove_lytaf_events_from_timeseries
>>> lyrats = ts.TimeSeries(sunpy.data.sample.LYRA_LEVEL3_TIMESERIES, source='LYRA')  # doctest: +REMOTE_DATA
>>> ts_nolars = remove_lytaf_events_from_timeseries(lyrats, artifacts=["LAR"])  # doctest: +REMOTE_DATA
To also retrieve information on the artifacts during that day:
>>> ts_nolars, artifact_status = remove_lytaf_events_from_timeseries(
...        lyrats, artifacts=["LAR"], return_artifacts=True)  # doctest: +REMOTE_DATA