resistics.testing module

Module for producing testing data for resistics

This includes testing data for:

  • Record

  • History

  • TimeMetadata

  • TimeData

  • DecimatedData

  • SpectraData

resistics.testing.record_example1() resistics.common.Record[source]

Get an example Record

resistics.testing.record_example2() resistics.common.Record[source]

Get an example Record

resistics.testing.history_example() resistics.common.History[source]

Get a History example

resistics.testing.time_metadata_1chan(fs: float = 10, first_time: str = '2021-01-01 00:00:00', n_samples: int = 11) resistics.time.TimeMetadata[source]

Get TimeMetadata for a single channel, “chan1”

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – The first time, by default “2021-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 11

Returns

TimeMetadata

Return type

TimeMetadata

resistics.testing.time_metadata_2chan(fs: float = 10, first_time: str = '2021-01-01 00:00:00', n_samples: int = 11) resistics.time.TimeMetadata[source]

Get a TimeMetadata instance with two channels, “chan1” and “chan2”

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – The first time, by default “2021-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 11

Returns

TimeMetadata

Return type

TimeMetadata

resistics.testing.time_metadata_mt(fs: float = 10, first_time: str = '2020-01-01 00:00:00', n_samples: int = 11) resistics.time.TimeMetadata[source]

Get a magnetotelluric time metadata with four channels “Ex”, “Ey”, “Hx”, “Hy”

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – The first time, by default “2020-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 11

Returns

TimeMetadata

Return type

TimeMetadata

resistics.testing.time_data_ones(fs: float = 10, first_time: str = '2020-01-01 00:00:00', n_samples: int = 10, dtype: Optional[Type] = None) resistics.time.TimeData[source]

TimeData with all ones

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – The time of the first sample, by default “2020-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 10

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

The TimeData

Return type

TimeData

resistics.testing.time_data_simple(fs: float = 10, first_time: str = '2020-01-01 00:00:00', dtype: Optional[Type] = None) resistics.time.TimeData[source]

Time data with 16 samples

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – The time of the first sample, by default “2020-01-01 00:00:00”

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

The TimeData

Return type

TimeData

resistics.testing.time_data_with_nans(fs: float = 10, first_time: str = '2020-01-01 00:00:00', dtype: Optional[Type] = None) resistics.time.TimeData[source]

TimeData with 16 samples and some nan values

Parameters
  • fs (float, optional) – Sampling frequency, by default 10

  • first_time (str, optional) – The time of the first sample, by default “2020-01-01 00:00:00”

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

The TimeData

Return type

TimeData

resistics.testing.time_data_linear(fs: float = 10, first_time: str = '2020-01-01 00:00:00', n_samples: int = 10, dtype: Optional[Type] = None) resistics.time.TimeData[source]

Get TimeData with linear data

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – Time of first sample, by default “2020-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 10

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

TimeData with linear values

Return type

TimeData

resistics.testing.time_data_random(fs: float = 10, first_time: str = '2020-01-01 00:00:00', n_samples: int = 10, dtype: Optional[Type] = None) resistics.time.TimeData[source]

TimeData with random values and specifiable number of samples

Parameters
  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – Time of first sample, by default “2020-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 10

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

The TimeData

Return type

TimeData

resistics.testing.time_data_periodic(frequencies: List[float], fs: float = 50, first_time: str = '2020-01-01 00:00:00', n_samples: int = 100, dtype: Optional[Type] = None) resistics.time.TimeData[source]

Get period TimeData

Parameters
  • frequencies (List[float]) – Frequencies to include

  • fs (float, optional) – Sampling frequency, by default 50

  • first_time (str, optional) – The first time, by default “2020-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 100

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

Periodic TimeData

Return type

TimeData

resistics.testing.time_data_with_offset(offset=0.05, fs: float = 10, first_time: str = '2020-01-01 00:00:00', n_samples: int = 11, dtype: Optional[Type] = None) resistics.time.TimeData[source]

Get TimeData with an offset on the sampling

Parameters
  • offset (float, optional) – The offset on the sampling in seconds, by default 0.05

  • fs (float, optional) – The sampling frequency, by default 10

  • first_time (str, optional) – The first time of the TimeData, by default “2020-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 11

  • dtype (Optional[Type], optional) – The data type for the values, by default None

Returns

The TimeData

Return type

TimeData

resistics.testing.decimated_metadata(fs: float = 0.25, first_time: str = '2021-01-01 00:00:00', n_samples: int = 1024, n_levels: int = 3, factor: int = 4) resistics.decimate.DecimatedMetadata[source]

Get example decimated metadata

The final level has n_samples. The number of samples for all other levels is calculated using a decimation factor of 4.

Similarly for the sampling frequencies, the final level is assumed to have a sample frequency of fs and all other levels sampling frequencies are calculated from there.

Parameters
  • fs (float, optional) – The sampling frequency of the last level, by default 0.25

  • first_time (str, optional) – The time of the first sample, by default “2021-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 1024

  • n_levels (int, optional) – The number of decimation levels, by default 3

  • factor (int, optional) – The decimation factor for each level, by default 4

Returns

DecimatedMetadata

Return type

DecimatedMetadata

resistics.testing.decimated_data_random(fs: float = 0.25, first_time: str = '2021-01-01 00:00:00', n_samples: int = 1024, n_levels: int = 3, factor: int = 4) resistics.decimate.DecimatedData[source]

Get random decimated data

Parameters
  • fs (float, optional) – Sampling frequency, by default 10

  • first_time (str, optional) – The time of the first sample, by default “2021-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 1024

  • n_levels (int, optional) – The number of levels, by default 3

  • factor (int, optional) – The decimation factor for each level, by default 4

Returns

The decimated data

Return type

DecimatedData

resistics.testing.decimated_data_linear(fs: float = 0.25, first_time: str = '2021-01-01 00:00:00', n_samples: int = 1024, n_levels: int = 3, factor: int = 4)[source]

Get linear decimated data

Parameters
  • fs (float, optional) – Sampling frequency, by default 10

  • first_time (str, optional) – The time of the first sample, by default “2021-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 1024

  • n_levels (int, optional) – The number of levels, by default 3

  • factor (int, optional) – The decimation factor for each level, by default 4

Returns

The decimated data

Return type

DecimatedData

resistics.testing.decimated_data_periodic(frequencies: Dict[str, List[float]], fs: float = 0.25, first_time: str = '2021-01-01 00:00:00', n_samples: int = 1024, n_levels: int = 3, factor: int = 4)[source]

Get periodic decimated data

Parameters
  • frequencies (Dict[str, List[float]]) – Mapping from channel to list of frequencies to add

  • fs (float, optional) – Sampling frequency, by default 10

  • first_time (str, optional) – The time of the first sample, by default “2021-01-01 00:00:00”

  • n_samples (int, optional) – The number of samples, by default 1024

  • n_levels (int, optional) – The number of levels, by default 3

  • factor (int, optional) – The decimation factor for each level, by default 4

Returns

The decimated data

Return type

DecimatedData

resistics.testing.spectra_metadata_multilevel(fs: float = 128, n_levels: int = 3, n_wins: Union[List[int], int] = 2, index_offset: Union[List[int], int] = 0, chans: Optional[List[str]] = None) resistics.spectra.SpectraMetadata[source]

Get spectra metadata with multiple levels and two channels

Parameters
  • fs (float, optional) – The original sampling frequency, by default 128

  • n_levels (int, optional) – The number of levels, by default 3

  • n_wins (Union[List[int], int]) – The number of windows for each level

  • index_offset (Union[List[int], int], optional) – The index offset vs. the reference time, by default 0

  • chans (Optional[List[str]]) – The channels in the data, by default None. If None, the channels will be chan1 and chan2

Returns

SpectraMetadata with n_levels

Return type

SpectraMetadata

Raises

ValueError – If the number of user input channels does not equal two

resistics.testing.spectra_data_basic() resistics.spectra.SpectraData[source]

Spectra data with a single decimation level

Returns

Spectra data with a single level, a single channel and two windows

Return type

SpectraData

resistics.testing.regression_input_metadata_mt(fs: float, freqs: List[float]) resistics.regression.RegressionInputMetadata[source]

Get example regression input metadata for single site mt

Parameters
  • fs (float) – The sampling frequency

  • freqs (List[float]) – The evaluation frequencies

Returns

Example regression input metadata with fs=128 and 5 evaluation frequencies

Return type

RegressionInputMetadata

resistics.testing.components_mt() Dict[str, resistics.transfunc.Component][source]

Get example components for the Impedance Tensor

Returns

Dictionary of component values (ExHx, ExHy, EyHx, EyHy)

Return type

Dict[str, Component]

resistics.testing.solution_mt() resistics.regression.Solution[source]

Get an example impedance tensor solution

Returns

The solution

Return type

Solution