reda.containers package¶
Different data containers available in REDA
Submodules¶
reda.containers.BaseContainer module¶
.
- class reda.containers.BaseContainer.BaseContainer(data=None, electrode_positions=None, topography=None, metadata=None, **kwargs)[source]¶
Bases:
LoggingClass
,ImportersBase
,ExportersBase
.
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
apply_k
(k)Apply geometric factors to the data
check_dataframe
(dataframe)Check the given dataframe for the required type and columns
compute_K_analytical
(spacing, **kwargs)Compute geometrical factors over the homogeneous half-space with a constant electrode spacing
Create a copy if the object.
delete_measurements
(row_or_rows)Delete one or more measurements by index of the DataFrame.
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
filter
(query[, inplace, reassess_norrec])Use a query statement to filter data.
Filter quadrupoles where A-B is not equal to M-N
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
Return True if container has multiple timesteps.
histogram
([column, filename, log10])Plot a histogram of one data column
merge_container
(container)Merge the data and electrode positions from another container into this one.
merge_norrec_data
([dataframe, inplace])Merge normal and reciprocal data by averaging all normal-reciprocal pairs
plot_electrode_positions_2d
([ax, use_y_axis])Create a 2D scatter plot for the electrode positions.
plot_histogram
([column, filename, log10])Wrapper for self.histogram
plot_topography_2d
([ax, use_y_axis])Plot topography points for x/z coordinates.
pseudosection_type1
([column, filename, log10])Plot a pseudosection of type 1 for the given column.
pseudosection_type2
([column, filename, log10])Plot a pseudosection of the given column.
pseudosection_type3
([column, filename, ...])Plot a pseudosection of a given column.
replace_electrode_positions
(coordinates)Replace the imported electrode coordinates by new ones.
setup_logger
([name])Setup a logger
sub_filter
(subset, filter[, inplace])Apply a filter to subset of the data
Return a config object that contains the measurement configurations (a,b,m,n) from the data
compute_K_numerical
load_metadata
print_data_journal
print_log
pseudosection
save_metadata
- compute_K_analytical(spacing, **kwargs)[source]¶
Compute geometrical factors over the homogeneous half-space with a constant electrode spacing
- create_copy()[source]¶
Create a copy if the object. This is useful to investigate different filtering strategies.
- delete_measurements(row_or_rows)[source]¶
Delete one or more measurements by index of the DataFrame.
Resets the DataFrame index.
- Parameters:
- row_or_rowsint or list of ints
Row numbers (starting with zero) of the data DataFrame (ert.data) to delete
- Returns:
- None
- filter(query, inplace=True, reassess_norrec=True)[source]¶
Use a query statement to filter data. Note that you specify the data to be removed!
- Parameters:
- querystring
The query string to be evaluated. Is directly provided to pandas.DataFrame.query
- inplacebool
if True, change the container dataframe in place (defaults to True). Otherwise, return a new ERT container which contains the filtered data.
- reassess_norrecbool (True)
if True, then recompute normal-reciprocal differences after applying the filter.
- Returns:
- result
reda.ERT
ERT container with filtered data
- result
- filter_non_equal_dipole_lengths()[source]¶
Filter quadrupoles where A-B is not equal to M-N
Only work in-place and returns this container
- histogram(column='r', filename=None, log10=False, **kwargs)[source]¶
Plot a histogram of one data column
- merge_norrec_data(dataframe=None, inplace=True)[source]¶
Merge normal and reciprocal data by averaging all normal-reciprocal pairs
- Parameters:
- dataframe: pandas.DataFrame|None, default: None
If not None, then use this data for the averaging. Otherwise, use .data of this container
- inplace: bool, default: True
If True, and dataframe is None, then replace .data with the merged data set
- Returns:
- data_merged: pandas.DataFrame
The merged data
- plot_electrode_positions_2d(ax=None, use_y_axis=False)[source]¶
Create a 2D scatter plot for the electrode positions. By default use the x and z coordinates.
- Parameters:
- axmatplotlib.axes, optional
Axes object to plot to. If None, create a new figure
- use_y_axisbool, optional
If true then use the y coordinates instead of z coordinates for plotting
- Returns:
- figmatplotlib.Figure|None
The Figure object related to ax. None if no electrode positions were registered yet.
- axmatplotlib.Axes|None
The axes object plotted to. None if no electrode positions were registered yet.
- plot_histogram(column='r', filename=None, log10=False, **kwargs)[source]¶
Wrapper for self.histogram
- plot_topography_2d(ax=None, use_y_axis=False)[source]¶
Plot topography points for x/z coordinates. If present, also plot electrode positions.
- Parameters:
- axmatplotlib.Axes|None, optional
If provided, plot into this axes object
- use_y_axisbool, optional
If true then use the y coordinates instead of z coordinates for plotting
- Returns:
- figmatplotlib.Figure|None
figure object or None if not topography data is present
- axmatplotlib.Axes|None
axes object or None if not topography data is present
- pseudosection_type1(column='r', filename=None, log10=False, **kwargs)[source]¶
Plot a pseudosection of type 1 for the given column. Note that this function only works with dipole-dipole data at the moment.
- Parameters:
- columnstring, optional
Column to plot into the pseudosection, default: r
- filenamestring, optional
if not None, save the resulting figure directory to disc
- log10bool, optional
if True, then plot values in log10, default: False
- **kwargsdict
all additional parameters are directly provided to
reda.plotters.pseudoplots.PS.plot_pseudosection_type1()
- Returns:
- fig
matplotlib.Figure
matplotlib figure object ax :
matplotlib.axes
matplotlib axes object- cbcolorbar object
matplotlib colorbar object
- fig
- pseudosection_type2(column='r', filename=None, log10=False, **kwargs)[source]¶
Plot a pseudosection of the given column. Note that this function only works with dipole-dipole data at the moment.
- Parameters:
- columnstring, optional
Column to plot into the pseudosection, default: r
- filenamestring, optional
if not None, save the resulting figure directory to disc
- log10bool, optional
if True, then plot values in log10, default: False
- **kwargsdict
all additional parameters are directly provided to
reda.plotters.pseudoplots.PS.plot_pseudosection_type2()
- force_to_normalbool, default: False
If True, force all data points to be plotted below the y=0 axis. This is useful to visualize nor-rec-merged data sets.
- Returns:
- fig
matplotlib.Figure
matplotlib figure object ax :
matplotlib.axes
matplotlib axes object- cbcolorbar object
matplotlib colorbar object
- fig
- pseudosection_type3(column='r', filename=None, log10=False, crmod_settings=None, **kwargs)[source]¶
Plot a pseudosection of a given column. Use sensitivity-based center of gravities for locations.
- replace_electrode_positions(coordinates)[source]¶
Replace the imported electrode coordinates by new ones. This function assumes and expects that the number of new coordinates is the same as the old ones (i.e., a simple replacement).
If the input is a pandas DataFrame, assume that the columns x, y, z are present.
- Parameters:
- coordinatesstr|numpy.ndarray|pandas.DataFrame
- class reda.containers.BaseContainer.ExportersBase[source]¶
Bases:
object
This class provides wrappers for most of the exporter functions and is meant to be inherited by the ERT data container.
See also
Importers
Methods
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
- export_bert(electrodes, filename)¶
Export to unified data format used in pyGIMLi & BERT.
Multiple timesteps are exported to multiple filenames.
- Parameters:
- data
pandas.DataFrame
DataFrame with at least a, b, m, n and r.
- electrodes
pandas.DataFrame
DataFrame with electrode positions.
- filenamestr
String of the output filename.
- data
- export_crtomo(group, norrec='all', store_errors=False)¶
Save a dataset to a CRTomo-compatible .crt file
- Parameters:
- filenamestring
Output filename
- grouppandas.group
Data group
- norrecstring
Which data to export Possible values: all|norrec|nor|rec
- store_errorsbool
If true, store errors of the data in a separate column
- export_pygimli(electrodes, filename)¶
Export to unified data format used in pyGIMLi & BERT.
Multiple timesteps are exported to multiple filenames.
- Parameters:
- data
pandas.DataFrame
DataFrame with at least a, b, m, n and r.
- electrodes
pandas.DataFrame
DataFrame with electrode positions.
- filenamestr
String of the output filename.
- data
- class reda.containers.BaseContainer.ImportersBase[source]¶
Bases:
object
Base class for all importer classes
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
merge_container
(container)Merge the data and electrode positions from another container into this one.
- add_dataframe(data, timestep=None, **kwargs)[source]¶
Add data to the container using another DataFrame
- Parameters:
- datapandas.DataFrame
Measurement data in the form of a DataFrame, must adhere to the container constraints (i.e., must have all required columns) and electrode positions already registered must match.
reda.containers.CR module¶
Complex-resistivity container
- class reda.containers.CR.CR(data=None, electrode_positions=None, topography=None, metadata=None, **kwargs)[source]¶
Bases:
BaseContainer
,CRImporters
.
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
apply_k
(k)Apply geometric factors to the data
check_dataframe
(dataframe)Check the given dataframe for the required type and columns
compute_K_analytical
(spacing, **kwargs)Compute geometrical factors over the homogeneous half-space with a constant electrode spacing
create_copy
()Create a copy if the object.
delete_measurements
(row_or_rows)Delete one or more measurements by index of the DataFrame.
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_to_crtomo_td_manager
(grid[, norrec])Return a ready-initialized tdman object from the CRTomo tools.
filter
(query[, inplace, reassess_norrec])Use a query statement to filter data.
filter_non_equal_dipole_lengths
()Filter quadrupoles where A-B is not equal to M-N
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
has_multiple_timesteps
()Return True if container has multiple timesteps.
histogram
([column, filename, log10])Plot a histogram of one data column
import_bert
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
import_crtomo_data
(filename, **kwargs)Import a CRTomo-style measurement file (usually: volt.dat).
import_mpt
(filename, **kwargs)MPT DAS 1 FD importer
import_pygimli
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
merge_container
(container)Merge the data and electrode positions from another container into this one.
merge_norrec_data
([dataframe, inplace])Merge normal and reciprocal data by averaging all normal-reciprocal pairs
plot_electrode_positions_2d
([ax, use_y_axis])Create a 2D scatter plot for the electrode positions.
plot_histogram
([column, filename, log10])Wrapper for self.histogram
plot_topography_2d
([ax, use_y_axis])Plot topography points for x/z coordinates.
pseudosection_type1
([column, filename, log10])Plot a pseudosection of type 1 for the given column.
pseudosection_type2
([column, filename, log10])Plot a pseudosection of the given column.
pseudosection_type3
([column, filename, ...])Plot a pseudosection of a given column.
replace_electrode_positions
(coordinates)Replace the imported electrode coordinates by new ones.
setup_logger
([name])Setup a logger
sub_filter
(subset, filter[, inplace])Apply a filter to subset of the data
to_configs
()Return a config object that contains the measurement configurations (a,b,m,n) from the data
compute_K_numerical
load_metadata
print_data_journal
print_log
pseudosection
save_metadata
- class reda.containers.CR.CRImporters[source]¶
Bases:
ImportersBase
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
import_bert
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
import_crtomo_data
(filename, **kwargs)Import a CRTomo-style measurement file (usually: volt.dat).
import_mpt
(filename, **kwargs)MPT DAS 1 FD importer
import_pygimli
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
merge_container
(container)Merge the data and electrode positions from another container into this one.
- import_bert(filename, **kwargs)[source]¶
BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
- Parameters:
- filenamestring
File path to .ohm file
- verbosebool, optional
Enables extended debug output
- reciprocalsint, optional
if provided, then assume that this is a reciprocal measurement where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- Returns:
- data
pandas.DataFrame
The measurement data
- elecs
pandas.DataFrame
Electrode positions (columns: X, Y, Z)
- topographyNone
No topography information is provided at the moment
- data
- import_crtomo_data(filename, **kwargs)[source]¶
Import a CRTomo-style measurement file (usually: volt.dat).
- Parameters:
- filenamestr
path to data file
- import_mpt(filename, **kwargs)[source]¶
MPT DAS 1 FD importer
- timestep: int or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Reads a time domain MPT DAS-1 data file (.Data) and prepares information in pandas DataFrame for further processing.
- Parameters:
- filenamestr
path to input file
- Returns:
- data
pandas.DataFrame
Contains the measurement data
- electrodes
pandas.DataFrame
Contains electrode positions (None at the moment)
- topographyNone
No topography information is contained in the text files, so we always return None
- data
- timestep: int or
- import_pygimli(filename, **kwargs)[source]¶
BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
- Parameters:
- filenamestring
File path to .ohm file
- verbosebool, optional
Enables extended debug output
- reciprocalsint, optional
if provided, then assume that this is a reciprocal measurement where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- Returns:
- data
pandas.DataFrame
The measurement data
- elecs
pandas.DataFrame
Electrode positions (columns: X, Y, Z)
- topographyNone
No topography information is provided at the moment
- data
reda.containers.ERT module¶
- class reda.containers.ERT.ERT(data=None, electrode_positions=None, topography=None, metadata=None, **kwargs)[source]¶
Bases:
BaseContainer
,ERTImporters
,ERTExporters
.
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
apply_k
(k)Apply geometric factors to the data
check_dataframe
(dataframe)Check the given dataframe for the required type and columns
compute_K_analytical
(spacing, **kwargs)Compute geometrical factors over the homogeneous half-space with a constant electrode spacing
compute_reciprocal_errors
([key])Compute reciprocal erros following LaBrecque et al. (1996) according to:.
create_copy
()Create a copy if the object.
delete_measurements
(row_or_rows)Delete one or more measurements by index of the DataFrame.
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_to_crtomo_td_manager
(grid[, norrec])Return a ready-initialized tdman object from the CRTomo tools.
export_to_pygimli_scheme
([norrec, timestep])Export the data into a pygimili.DataContainerERT object.
export_tsert
(filename, version, **kwargs)Export data to TSERT
filter
(query[, inplace, reassess_norrec])Use a query statement to filter data.
filter_non_equal_dipole_lengths
()Filter quadrupoles where A-B is not equal to M-N
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
has_multiple_timesteps
()Return True if container has multiple timesteps.
histogram
([column, filename, log10])Plot a histogram of one data column
import_bert
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
import_crtomo_data
(filename, **kwargs)Import a CRTomo-style measurement file (usually: volt.dat).
import_mpt
(filename, **kwargs)MPT DAS 1 importer
import_pygimli
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
import_syscal_bin
(filename, **kwargs)Syscal import
import_syscal_txt
(filename, **kwargs)Syscal import
import_tsert
(filename[, timesteps, version])TSERT import
merge_container
(container)Merge the data and electrode positions from another container into this one.
merge_norrec_data
([dataframe, inplace])Merge normal and reciprocal data by averaging all normal-reciprocal pairs
plot_electrode_positions_2d
([ax, use_y_axis])Create a 2D scatter plot for the electrode positions.
plot_histogram
([column, filename, log10])Wrapper for self.histogram
plot_topography_2d
([ax, use_y_axis])Plot topography points for x/z coordinates.
pseudosection_type1
([column, filename, log10])Plot a pseudosection of type 1 for the given column.
pseudosection_type2
([column, filename, log10])Plot a pseudosection of the given column.
pseudosection_type3
([column, filename, ...])Plot a pseudosection of a given column.
replace_electrode_positions
(coordinates)Replace the imported electrode coordinates by new ones.
setup_logger
([name])Setup a logger
sub_filter
(subset, filter[, inplace])Apply a filter to subset of the data
to_configs
()Return a config object that contains the measurement configurations (a,b,m,n) from the data
tsert_summary
(filename, **kwargs)Try to open a given filename (usually a .h5 file) as a TSERT file and print out a summary of contained data.
compute_K_numerical
load_metadata
print_data_journal
print_log
pseudosection
save_metadata
- compute_reciprocal_errors(key='r')[source]¶
Compute reciprocal erros following LaBrecque et al. (1996) according to:
\[\epsilon = \left|\frac{2(|R_n| - |R_r|)}{|R_n| + |R_r|}\right|\]- Parameters:
- keystr
Parameter to calculate the reciprocal error for (default is “r”).
Examples
>>> import reda >>> ert = reda.ERT() >>> ert.data = reda.utils.norrec.get_test_df() >>> ert.data = pd.DataFrame([ ... [1,2,3,4,95], ... [3,4,2,1,-105]], columns=list("abmnr") ... ) >>> ert.compute_reciprocal_errors() >>> ert.data["error"].mean() == 0.1 True
- class reda.containers.ERT.ERTExporters[source]¶
Bases:
object
Methods
export_to_crtomo_td_manager
(grid[, norrec])Return a ready-initialized tdman object from the CRTomo tools.
export_to_pygimli_scheme
([norrec, timestep])Export the data into a pygimili.DataContainerERT object.
export_tsert
(filename, version, **kwargs)Export data to TSERT
- export_to_crtomo_td_manager(grid, norrec='norrec')[source]¶
Return a ready-initialized tdman object from the CRTomo tools.
WARNING: Not timestep aware!
- Parameters:
- gridcrtomo.crt_grid
A CRTomo grid instance
- norrecstr (nor|rec|norrec)
Which data to export. Default: norrec (all)
- class reda.containers.ERT.ERTImporters[source]¶
Bases:
ImportersBase
This class provides wrappers for most of the importer functions and is meant to be inherited by the ERT data container.
See also
Exporters
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
import_bert
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
import_crtomo_data
(filename, **kwargs)Import a CRTomo-style measurement file (usually: volt.dat).
import_mpt
(filename, **kwargs)MPT DAS 1 importer
import_pygimli
(filename, **kwargs)BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
import_syscal_bin
(filename, **kwargs)Syscal import
import_syscal_txt
(filename, **kwargs)Syscal import
import_tsert
(filename[, timesteps, version])TSERT import
merge_container
(container)Merge the data and electrode positions from another container into this one.
tsert_summary
(filename, **kwargs)Try to open a given filename (usually a .h5 file) as a TSERT file and print out a summary of contained data.
- import_bert(filename, **kwargs)[source]¶
BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
- Parameters:
- filenamestring
File path to .ohm file
- verbosebool, optional
Enables extended debug output
- reciprocalsint, optional
if provided, then assume that this is a reciprocal measurement where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- Returns:
- data
pandas.DataFrame
The measurement data
- elecs
pandas.DataFrame
Electrode positions (columns: X, Y, Z)
- topographyNone
No topography information is provided at the moment
- data
- import_crtomo_data(filename, **kwargs)[source]¶
Import a CRTomo-style measurement file (usually: volt.dat).
- Parameters:
- filenamestr
path to data file
- import_mpt(filename, **kwargs)[source]¶
MPT DAS 1 importer
- timestepint or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Reads a any MPT DAS-1 data file (.Data), e.g. TD/FD/SIP, and prepares information in pandas DataFrame for further processing.
- Parameters:
- filenamestring
path to input file
- Returns:
- data
pandas.DataFrame
Contains the measurement data
- electrodes
pandas.DataFrame
Contains electrode positions (None at the moment)
- topographyNone
No topography information is contained in the text files, so we always return None
- data
- timestepint or
- import_pygimli(filename, **kwargs)[source]¶
BERT .ohm file importConstruct pandas data frame from BERT`s unified data format (.ohm).
- Parameters:
- filenamestring
File path to .ohm file
- verbosebool, optional
Enables extended debug output
- reciprocalsint, optional
if provided, then assume that this is a reciprocal measurement where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- Returns:
- data
pandas.DataFrame
The measurement data
- elecs
pandas.DataFrame
Electrode positions (columns: X, Y, Z)
- topographyNone
No topography information is provided at the moment
- data
- import_syscal_bin(filename, **kwargs)[source]¶
Syscal import
- timestep: int or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Read a .bin file generated by the IRIS Instruments Syscal Systems
and return a curated Pandas dataframe for further processing. This dataframe contains only information currently deemed important. Use the function reda.importers.iris_syscal_pro_binary._import_bin to extract ALL information from a given .bin file.
Note that the .bin files contain electrodes positions for the electrodes. Electrode numbers are then inferred from those.
- Parameters:
- filenamestring|io.BytesIO
path to input filename or io.BytesIO object containing the binary data
- assume_regular_electrodes_xNone|tuple(nr_electrodes, spacing)
If not None, then assume measurements were taken using a profile of regular electrodes in x directions. Fill in any electrodes not used in the data to align the logical electrode numbers wit the physical electrode numbers. Use the electrode spacing set in the system (usually a default of 1 m is used), and then change this to the real spacing using the ‘elecs_transform_reg_spacing_x’ parameter.
- elecs_transform_reg_spacing_xtuple(old, new)|None, optional
If not None, then assume a regular electrode spacing in x direction with spacing ‘old’. This is often 1 m, a default of the systems. However, in reality often other spacings are used, and this parameter will lead to a transformation of the old (device-specific) spacing to the true spacing.
- shift_by_xyztuple|list|numpy.ndarray of size 1 or 2 or 3, optional
If set, shift electrode positions by adding this vector Length of 1 assumes that only the x coordinate of the vector differs from zero. Length of 2 assume a shift in (x,z) direction.
This parameter is evaluated after the ‘elecs_transform_reg_spacing_x’ parameter - as such you can and must use real spacings in this case.
- reciprocalsint, optional
if provided, then assume that this is a reciprocal measurement where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- check_meas_numsbool, optional
if True, then check that the measurement numbers are consecutive. Don’t return data after a jump to smaller measurement numbers (this usually indicates that more data points were downloaded than are part of a specific measurement. Default: True
- skip_rowsint, optional
Ignore this number of rows at the beginning, e.g., because they were inadvertently imported from an earlier measurement. Default: 0
- Returns:
- data
pandas.DataFrame
Contains the measurement data
- elec_mgr
reda.utils.electrode_manager.electrode_manager
Electrode manager that manages the electrode positions
- topographyNone
No topography information is contained in the text files, so we always return None
- data
- timestep: int or
- import_syscal_txt(filename, **kwargs)[source]¶
Syscal import
- timestep: int or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Import Syscal measurements from a text file, exported as ‘Spreadsheet’.
At this point we expect only x-coordinates to be exported. As such the columns Spa.1 to Spa.4 are assumed to be x coordinates for a,b,m,n.
- Parameters:
- filename: str
Input filename
- assume_regular_electrodes_xNone|tuple(nr_electrodes, spacing)
If not None, then assume measurements were taken using a profile of regular electrodes in x directions. Fill in any electrodes not used in the data to align the logical electrode numbers with the physical electrode numbers. Use the electrode spacing set in the system (usually a default of 1 m is used), and then change this to the real spacing using the ‘elecs_transform_reg_spacing_x’ parameter.
- elecs_transform_reg_spacing_xtuple(old, new)|None, optional
If not None, then assume a regular electrode spacing in x direction with spacing ‘old’. This is often 1 m, a default of the systems. However, in reality often other spacings are used, and this parameter will lead to a transformation of the old (device-specific) spacing to the true spacing.
- shift_by_xyztuple|list|numpy.ndarray of size 1 or 2 or 3, optional
If set, shift electrode positions by adding this vector Length of 1 assumes that only the x coordinate of the vector differs from zero. Length of 2 assume a shift in (x,z) direction.
This parameter is evaluated after the ‘elecs_transform_reg_spacing_x’ parameter - as such you can and must use real spacings in this case.
- reciprocals: int, optional
if provided, then assume that this is a reciprocal measurements where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- Returns:
- data:
pandas.DataFrame
Contains the measurement data
- elec_mgr
reda.utils.electrode_manager.electrode_manager
Electrode manager that manages the electrode positions
- topography: None
No topography information is contained in the text files, so we always return None
- data:
- timestep: int or
- import_tsert(filename, timesteps='all', version='base', **kwargs)[source]¶
TSERT import
- Parameters:
- filenamestr
Path to hdf file to import data from
- timestepsstr|list|datetime.datetime
Timesteps that should be imported
- versionstr
Which version of the data to load. Time steps that do not have this specific version are ignored. Default: base version
reda.containers.SIP module¶
Container for Spectral Induced Polarization (SIP) measurements
- class reda.containers.SIP.SIP(data=None, electrode_positions=None, topography=None)[source]¶
Bases:
BaseContainer
,SIPImporters
.
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
apply_k
(k)Apply geometric factors to the data
check_dataframe
(dataframe)Check the given dataframe for the required type and columns
compute_K_analytical
(spacing, **kwargs)Compute geometrical factors over the homogeneous half-space with a constant electrode spacing
create_copy
()Create a copy if the object.
delete_measurements
(row_or_rows)Delete one or more measurements by index of the DataFrame.
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
filter
(query[, inplace, reassess_norrec])Use a query statement to filter data.
filter_non_equal_dipole_lengths
()Filter quadrupoles where A-B is not equal to M-N
Return all frequencies
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
has_multiple_timesteps
()Return True if container has multiple timesteps.
histogram
([column, filename, log10])Plot a histogram of one data column
import_mpt
(filename, **kwargs)MPT DAS 1 FD importer
import_sip04
(filename[, timestep])SIP04 data import
merge_container
(container)Merge the data and electrode positions from another container into this one.
merge_norrec_data
([dataframe, inplace])Merge normal and reciprocal data by averaging all normal-reciprocal pairs
plot_electrode_positions_2d
([ax, use_y_axis])Create a 2D scatter plot for the electrode positions.
plot_histogram
([column, filename, log10])Wrapper for self.histogram
plot_topography_2d
([ax, use_y_axis])Plot topography points for x/z coordinates.
pseudosection_type1
([column, filename, log10])Plot a pseudosection of type 1 for the given column.
pseudosection_type2
([column, filename, log10])Plot a pseudosection of the given column.
pseudosection_type3
([column, filename, ...])Plot a pseudosection of a given column.
In case multiple frequencies were measured, average them and compute std, min, max values for zt.
replace_electrode_positions
(coordinates)Replace the imported electrode coordinates by new ones.
setup_logger
([name])Setup a logger
sub_filter
(subset, filter[, inplace])Apply a filter to subset of the data
to_configs
()Return a config object that contains the measurement configurations (a,b,m,n) from the data
compute_K_numerical
export_specs_to_ascii
load_metadata
print_data_journal
print_log
pseudosection
save_metadata
- reduce_duplicate_frequencies()[source]¶
In case multiple frequencies were measured, average them and compute std, min, max values for zt.
In case timesteps were added (i.e., multiple separate measurements), group over those and average for each timestep.
Examples
import tempfile import reda with tempfile.TemporaryDirectory() as fid: reda.data.download_data('sip04_fs_06', fid) sip = reda.SIP() sip.import_sip04(fid + '/sip_dataA.mat', timestep=0) # well, add the spectrum again as another timestep sip.import_sip04(fid + '/sip_dataA.mat', timestep=1) df = sip.reduce_duplicate_frequencies()
- class reda.containers.SIP.SIPImporters[source]¶
Bases:
ImportersBase
This class provides wrappers for most of the importer functions, and is meant to be inherited by the data containers
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
import_mpt
(filename, **kwargs)MPT DAS 1 FD importer
import_sip04
(filename[, timestep])SIP04 data import
merge_container
(container)Merge the data and electrode positions from another container into this one.
- import_mpt(filename, **kwargs)[source]¶
MPT DAS 1 FD importer
- timestep: int or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Reads a time domain MPT DAS-1 data file (.Data) and prepares information in pandas DataFrame for further processing.
- Parameters:
- filenamestr
path to input file
- Returns:
- data
pandas.DataFrame
Contains the measurement data
- electrodes
pandas.DataFrame
Contains electrode positions (None at the moment)
- topographyNone
No topography information is contained in the text files, so we always return None
- data
- timestep: int or
- import_sip04(filename, timestep=None)[source]¶
SIP04 data import
- Parameters:
- filename: string
Path to .mat or .csv file containing SIP-04 measurement results
Examples
import tempfile import reda with tempfile.TemporaryDirectory() as fid: reda.data.download_data('sip04_fs_01', fid) sip = reda.SIP() sip.import_sip04(fid + '/sip_dataA.mat')
reda.containers.TDIP module¶
Time-domain IP (induced polarization) container
- class reda.containers.TDIP.TDIP(data=None, electrode_positions=None, topography=None, metadata=None, **kwargs)[source]¶
Bases:
BaseContainer
,TDIPImporters
.
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
apply_k
(k)Apply geometric factors to the data
check_dataframe
(dataframe)Check the given dataframe for the required type and columns
compute_K_analytical
(spacing, **kwargs)Compute geometrical factors over the homogeneous half-space with a constant electrode spacing
create_copy
()Create a copy if the object.
delete_measurements
(row_or_rows)Delete one or more measurements by index of the DataFrame.
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
filter
(query[, inplace, reassess_norrec])Use a query statement to filter data.
filter_non_equal_dipole_lengths
()Filter quadrupoles where A-B is not equal to M-N
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
has_multiple_timesteps
()Return True if container has multiple timesteps.
histogram
([column, filename, log10])Plot a histogram of one data column
import_mpt
(filename, **kwargs)MPT DAS 1 TD importer
import_syscal_bin
(filename, **kwargs)Syscal import
merge_container
(container)Merge the data and electrode positions from another container into this one.
merge_norrec_data
([dataframe, inplace])Merge normal and reciprocal data by averaging all normal-reciprocal pairs
plot_decay_curve
([filename, index_nor, ...])Plot decay curve
plot_electrode_positions_2d
([ax, use_y_axis])Create a 2D scatter plot for the electrode positions.
plot_histogram
([column, filename, log10])Wrapper for self.histogram
plot_topography_2d
([ax, use_y_axis])Plot topography points for x/z coordinates.
pseudosection_type1
([column, filename, log10])Plot a pseudosection of type 1 for the given column.
pseudosection_type2
([column, filename, log10])Plot a pseudosection of the given column.
pseudosection_type3
([column, filename, ...])Plot a pseudosection of a given column.
replace_electrode_positions
(coordinates)Replace the imported electrode coordinates by new ones.
setup_logger
([name])Setup a logger
sub_filter
(subset, filter[, inplace])Apply a filter to subset of the data
to_configs
()Return a config object that contains the measurement configurations (a,b,m,n) from the data
to_cr
([b, estimate_b, conversion_parameters])Convert container to a complex resistivity container, using the CPA-conversion.
to_ert
()Return the data contained here within a ERT container
compute_K_numerical
load_metadata
print_data_journal
print_log
pseudosection
save_metadata
- plot_decay_curve(filename=None, index_nor=None, index_rec=None, nr_id=None, abmn=None, return_fig=False)[source]¶
Plot decay curve
Input scheme: We recognize three ways to specify the quadrupoles to plot (in descending priority):
indices for normal/reciprocal
by specifying the id
by specifying abmn (note that here the exact quadrupole must be present. For example, when (1,2,4,3) is requested, (2,1,4,3) will not be used).
- Parameters:
- filenamestring, optional
If given, filename to plot to.
- Returns:
- fig
matplotlib.Figure
Figure object, only returned if return_fig=True
- fig
- to_cr(b=-1.5, estimate_b=False, conversion_parameters={'n': 100, 'nhc': 4, 'phi_max': -1, 'phi_min': -100, 'tmax': 1.7, 'tmin': 0.12, 'tpuls': 2})[source]¶
Convert container to a complex resistivity container, using the CPA-conversion.
Kemna, 2000
COMPLEX RESISTIVITY COPPER MlNERALlZATlONt SPECTRA OF PORPHYRY Van Voorhis, G. D.; Nelson, P. H.; Drake, T. L. Geophysics (1973 Jan 1) 38 (1): 49-60.
Application of complex resistivity tomography to field data from a kerosene-contaminated siteGold Open Access Authors: A. Kemna, E. Räkers and A. Binley DOI: 10.3997/2214-4609.201407300
Gianluca Fiandaca, Esben Auken, Anders Vest Christiansen, and Aurélie Gazoty (2012). ”Time-domain-induced polarization: Full-decay forward modeling and 1D laterally constrained inversion of Cole-Cole parameters.” GEOPHYSICS, 77(3), E213-E225. https://doi.org/10.1190/geo2011-0217.1
- Parameters:
- bfloat
Factor for the conversion of chargeability into phase: phase = b * chargeability Default value equals -1.5, which is a good approximation for many cases
- estimate_bbool
If “True” the factor b is estimated according to the CPA model, for a given set of conversion parameters (provided via “conversion_paramaters”)
- conversion_parametersdict
Holds the conversion parameters which are the basis for the estimation of the factor b. Parameters in the dictionary:
- phi_minfloat
Lower phase boundary
- phi_maxfloat
Upper phase boundary
- nint
Number of values in the phase field
- nhcint
Number of half cycles
- tpulsfloat
Duration of one puls
- tminfloat
Lower time boundary
- tmaxfloat
Upper time boundary
- class reda.containers.TDIP.TDIPImporters[source]¶
Bases:
ImportersBase
This class provides wrappers for most of the importer functions and is meant to be inherited by the TDIP data container.
See also
Exporters
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
import_mpt
(filename, **kwargs)MPT DAS 1 TD importer
import_syscal_bin
(filename, **kwargs)Syscal import
merge_container
(container)Merge the data and electrode positions from another container into this one.
- import_mpt(filename, **kwargs)[source]¶
MPT DAS 1 TD importer
- timestep: int or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Reads a time domain MPT DAS-1 data file (.Data) and prepares information in pandas DataFrame for further processing.
- Parameters:
- filenamestr
path to input file
- Returns:
- data
pandas.DataFrame
Contains the measurement data
- electrodes
pandas.DataFrame
Contains electrode positions (None at the moment)
- topographyNone
No topography information is contained in the text files, so we always return None
- data
- timestep: int or
- import_syscal_bin(filename, **kwargs)[source]¶
Syscal import
- timestep: int or
datetime.datetime
if provided use this value to set the ‘timestep’ column of the produced dataframe. Default: 0
Read a .bin file generated by the IRIS Instruments Syscal Systems
and return a curated Pandas dataframe for further processing. This dataframe contains only information currently deemed important. Use the function reda.importers.iris_syscal_pro_binary._import_bin to extract ALL information from a given .bin file.
Note that the .bin files contain electrodes positions for the electrodes. Electrode numbers are then inferred from those.
- Parameters:
- filenamestring|io.BytesIO
path to input filename or io.BytesIO object containing the binary data
- assume_regular_electrodes_xNone|tuple(nr_electrodes, spacing)
If not None, then assume measurements were taken using a profile of regular electrodes in x directions. Fill in any electrodes not used in the data to align the logical electrode numbers wit the physical electrode numbers. Use the electrode spacing set in the system (usually a default of 1 m is used), and then change this to the real spacing using the ‘elecs_transform_reg_spacing_x’ parameter.
- elecs_transform_reg_spacing_xtuple(old, new)|None, optional
If not None, then assume a regular electrode spacing in x direction with spacing ‘old’. This is often 1 m, a default of the systems. However, in reality often other spacings are used, and this parameter will lead to a transformation of the old (device-specific) spacing to the true spacing.
- shift_by_xyztuple|list|numpy.ndarray of size 1 or 2 or 3, optional
If set, shift electrode positions by adding this vector Length of 1 assumes that only the x coordinate of the vector differs from zero. Length of 2 assume a shift in (x,z) direction.
This parameter is evaluated after the ‘elecs_transform_reg_spacing_x’ parameter - as such you can and must use real spacings in this case.
- reciprocalsint, optional
if provided, then assume that this is a reciprocal measurement where only the electrode cables were switched. The provided number N is treated as the maximum electrode number, and denotations are renamed according to the equation \(X_n = N - (X_a - 1)\)
- check_meas_numsbool, optional
if True, then check that the measurement numbers are consecutive. Don’t return data after a jump to smaller measurement numbers (this usually indicates that more data points were downloaded than are part of a specific measurement. Default: True
- skip_rowsint, optional
Ignore this number of rows at the beginning, e.g., because they were inadvertently imported from an earlier measurement. Default: 0
- Returns:
- data
pandas.DataFrame
Contains the measurement data
- elec_mgr
reda.utils.electrode_manager.electrode_manager
Electrode manager that manages the electrode positions
- topographyNone
No topography information is contained in the text files, so we always return None
- data
- timestep: int or
reda.containers.sEIT module¶
Spectral Electrical Impedance Tomography (sEIT) container
This container holds multi-frequency (spectral) imaging data, that is multiple SIP/EIS spectra for different four-point spreads, usually used for subsequent tomographic analysis.
- class reda.containers.sEIT.sEIT(dataframe=None)[source]¶
Bases:
BaseContainer
,sEITImporters
- Attributes:
Nf
Shortcut for self.nr_frequencies
- abmn
frequencies
Return the frequencies contained in the data set
nr_frequencies
Return the number of frequencies in the data set
nr_timesteps
Return the number of timesteps registered with this container
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
apply_k
(k)Apply geometric factors to the data
check_dataframe
(dataframe)Check the given dataframe for the required columns
compute_K_analytical
(spacing)Assuming an equal electrode spacing, compute the K-factor over a homogeneous half-space.
create_copy
()Create a copy if the object.
debye_decomposition_one_spectrum
(abmn, spectrum)Conduct a Debye Decomposition on each spectrum.
delete_measurements
(row_or_rows)Delete one or more measurements by index of the DataFrame.
export_bert
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_crtomo
(group[, norrec, store_errors])Save a dataset to a CRTomo-compatible .crt file
export_pygimli
(electrodes, filename)Export to unified data format used in pyGIMLi & BERT.
export_to_crtomo_multi_frequency
(directory)Export the sEIT data into data files that can be read by CRTomo.
export_to_crtomo_one_frequency
(volt_file, ...)Export one frequency into a CRTomo volt.dat file
export_to_crtomo_seit_manager
(grid[, norrec])Return a ready-initialized seit-manager object from the CRTomo tools.
export_to_crtomo_td_manager
(grid, frequency)Return a ready-initialized tdman object from the CRTomo tools.
filter
(query[, inplace])Use a query statement to filter data.
filter_incomplete_spectra
([flimit, percAccept])Remove all data points that belong to spectra that did not retain at least percAccept percent of the number of data points.
filter_non_equal_dipole_lengths
()Filter quadrupoles where A-B is not equal to M-N
Swap electrode denotations so that geometrical (K) factors become positive.
Return all unique (a,b,m,n) configurations in this container.
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
get_spectrum
([nr_id, abmn, withK, plot_filename])Return a spectrum and its reciprocal counter part, if present in the dataset.
has_multiple_timesteps
()Return True if container has multiple timesteps.
histogram
([column, filename, log10])Plot a histogram of one data column
import_crtomo
(directory[, frequency_file, ...])CRTomo importerLoad sEIT data from data directory.
import_eit_fzj
(filename, configfile[, ...])EIT data import for FZJ Medusa systems
import_mpt_das1
(filename[, timestep])Import MPT DAS-1 SIP data
import_sip256c
(filename[, settings, reciprocal])Radic SIP256c data import
keep_frequencies
(frequencies)Keep only the requested frequencies, remove everything else.
keep_only_configs
(configs_to_keep[, frequency])Keep only the supplied configs.
merge_container
(container)Merge the data and electrode positions from another container into this one.
merge_norrec_data
([dataframe, inplace])Merge normal and reciprocal data by averaging all normal-reciprocal pairs
plot_all_spectra
(outdir)This is a convenience function to plot ALL spectra currently stored in the container.
plot_electrode_positions_2d
([ax, use_y_axis])Create a 2D scatter plot for the electrode positions.
plot_histogram
([column, filename, log10])Wrapper for self.histogram
plot_histograms
([column, primary_dim, filename])Plot a histograms for all frequencies of one data column
plot_pseudosections
(column[, filename, ...])Create a multi-plot with one pseudosection of type 1 for each frequency.
plot_topography_2d
([ax, use_y_axis])Plot topography points for x/z coordinates.
pseudosection_type1
([column, filename, log10])Plot a pseudosection of type 1 for the given column.
pseudosection_type2
([column, filename, log10])Plot a pseudosection of the given column.
pseudosection_type3
([column, filename, ...])Plot a pseudosection of a given column.
query
(query[, inplace])State what you want to keep
remove_frequencies
(fmin, fmax)Remove frequencies outside the provided range from the dataset.
replace_electrode_positions
(coordinates)Replace the imported electrode coordinates by new ones.
scatter_norrec
([filename, individual])Create a scatter plot for all diff pairs
setup_logger
([name])Setup a logger
sub_filter
(subset, filter[, inplace])Apply a filter to subset of the data
subquery
(subset, filter[, inplace])Examples
to_configs
()Return a config object that contains the measurement configurations (a,b,m,n) from the data
compute_K_numerical
correct_for_cable_inductances
debye_decomposition_all_spectra
export_to_ascii
load_metadata
print_data_journal
print_log
pseudosection
save_metadata
- property Nf¶
Shortcut for self.nr_frequencies
- property abmn¶
- compute_K_analytical(spacing)[source]¶
Assuming an equal electrode spacing, compute the K-factor over a homogeneous half-space.
For more complex grids, please refer to the module: reda.utils.geometric_factors
- Parameters:
- spacingfloat
Electrode spacing
- debye_decomposition_one_spectrum(abmn, spectrum, gen_plots_in_dir=None)[source]¶
Conduct a Debye Decomposition on each spectrum. Save certain parameters in sEIT.data columns and/or return fit data
- export_to_crtomo_multi_frequency(directory, norrec='norrec')[source]¶
Export the sEIT data into data files that can be read by CRTomo.
- Parameters:
- directorystring
output directory. will be created if required
- norrecstring (nor|rec|norrec)
Which data to export. Default: norrec
- export_to_crtomo_one_frequency(volt_file, frequency, norrec='norrec')[source]¶
Export one frequency into a CRTomo volt.dat file
- Parameters:
- volt_filestring
output file. Will be overwritten if it exists
- frequencyfloat
frequency to export
- norrecstr (nor|rec|norrec)
Which data to export. Default: norrec
- export_to_crtomo_seit_manager(grid, norrec='norrec')[source]¶
Return a ready-initialized seit-manager object from the CRTomo tools. This function only works if the crtomo_tools are installed.
WARNING: Not timestep aware!
- Parameters:
- gridcrtomo.crt_grid
A CRTomo grid instance
- norrecstr (nor|rec|norrec)
Which data to export. Default: norrec (all)
- export_to_crtomo_td_manager(grid, frequency, norrec='norrec')[source]¶
Return a ready-initialized tdman object from the CRTomo tools. Use the given frequency data to initialize it.
WARNING: Not timestep aware!
- Parameters:
- gridcrtomo.crt_grid
A CRTomo grid instance
- frequencyfloat
The frequency to export data for
- norrecstr (nor|rec|norrec)
Which data to export. Default: norrec (all)
- filter(query, inplace=True)[source]¶
Use a query statement to filter data. Note that you specify the data to be removed!
- Parameters:
- querystring
The query string to be evaluated. Is directly provided to pandas.DataFrame.query
- inplacebool, optional (default: True)
if True, change the container dataframe in place (defaults to True)
- Returns:
- result
pandas.DataFrame
DataFrame that contains the result of the filter application
- result
- filter_incomplete_spectra(flimit=1000, percAccept=85)[source]¶
Remove all data points that belong to spectra that did not retain at least percAccept percent of the number of data points.
- Parameters:
- flimitfloat, optional (default: 1000)
The frequency limit up to which the criterium will be applied. The value is included into the range (<= flimit)
- percAcceptfloat, optional (default: 85)
The percentage of retained data points below which a spectrum is removed
- ..warning::
This function does not honor additional dimensions (e.g., timesteps) yet!
- fix_sign_with_K()[source]¶
Swap electrode denotations so that geometrical (K) factors become positive. Also, swap signs of all parameters affected by this process.
Affected parameters, at the moment, are:
k
r
Vmn
Zt
rho_a
rpha
- Parameters:
- dataframepandas.DateFrame
dataframe holding the data
- Returns:
- dataframepandas.DateFrame
the fixed dataframe
- property frequencies¶
Return the frequencies contained in the data set
- get_configs()[source]¶
Return all unique (a,b,m,n) configurations in this container. Does not differentiate between frequencies.
- Returns:
- unique_configsNx4 numpy.ndarray
The configurations, 1. indexed (starting with 1)
- get_spectrum(nr_id=None, abmn=None, withK=False, plot_filename=None)[source]¶
Return a spectrum and its reciprocal counter part, if present in the dataset. Optimally, refer to the spectrum by its normal-reciprocal id.
If the timestep column is present, then return dictionaries for normal and reciprocal data, with one sip_response object associated with each timestep.
If the parameter plot_filename is specified, then plots will be created using the SIP objects. If multiple timesteps are present, then the parameter plot_filename will be used as a template, and the timesteps will be appended for each plot.
- Parameters:
- withKbool
If True, and the column “k” exists, then return an apparent spectrum with geometric factors included
- Returns:
- spectrum_nor
reda.eis.plots.sip_response
or dict or None Normal spectrum. None if no normal spectrum is available
- spectrum_rec
reda.eis.plots.sip_response
or dict or None Reciprocal spectrum. None if no reciprocal spectrum is available
- fig
matplotlib.Figure.Figure
, optional Figure object (only if plot_filename is set)
- spectrum_nor
- keep_frequencies(frequencies)[source]¶
Keep only the requested frequencies, remove everything else.
- Parameters:
- frequenciestuple
Tuple of frequencies to keep.
- keep_only_configs(configs_to_keep, frequency=None)[source]¶
Keep only the supplied configs. If frequency is provided, only this frequency is filtered and all other frequencies are left as is.
- Parameters:
- property nr_frequencies¶
Return the number of frequencies in the data set
- property nr_timesteps¶
Return the number of timesteps registered with this container
- plot_all_spectra(outdir)[source]¶
This is a convenience function to plot ALL spectra currently stored in the container. It is useful to asses whether data filters do perform correctly.
Note that the function just iterates over all ids and plots the corresponding spectra, thus it is slow.
Spectra a named using the format: %.2i_spectrum_id_{}.png.
- Parameters:
- outdirstring
Output directory to store spectra in. Created if it does not exist.
- plot_histograms(column='r', primary_dim=None, filename=None, **kwargs)[source]¶
Plot a histograms for all frequencies of one data column
- Parameters:
- columnstr, optional
data column to plot. defaults to “r” for resistance
- primary_dimNone|str
???
- filenameNone|str
Prefix for filename. Do not add a file ending here, as additional string will be appended here.
- **kwargsdict
???
- TODO: Check saving to file for more than one secondary dimension
- Parameters
- ———-
- plot_pseudosections(column, filename=None, return_fig=False)[source]¶
Create a multi-plot with one pseudosection of type 1 for each frequency.
- Parameters:
- columnstring
which column to plot
- filenameNone|string
output filename. If set to None, do not write to file. Default: None
- return_figbool
if True, return the generated figure object, also if filename is set. Default: False
- Returns:
- figNone|matplotlib.Figure
if return_fig is set to True or filename is None, return the generated Figure object
- remove_frequencies(fmin, fmax)[source]¶
Remove frequencies outside the provided range from the dataset.
fmin and max will also be excluded.
- Parameters:
- fminfloat
Minimal frequency to be excluded
- fmaxfloat
Maximal frequency to be excluded
- scatter_norrec(filename=None, individual=False)[source]¶
Create a scatter plot for all diff pairs
- Parameters:
- filenamestring, optional
if given, save plot to file
- individualbool, optional
if set to True, return one figure for each row
- Returns:
- figmatplotlib.Figure or list of
matplotlib.Figure.Figure
objects the figure object
- axeslist of matplotlib.axes
the individual axes
- figmatplotlib.Figure or list of
- class reda.containers.sEIT.sEITImporters[source]¶
Bases:
ImportersBase
This class provides wrappers for most of the importer functions, and is meant to be inherited by the data containers
Methods
add_dataframe
(data[, timestep])Add data to the container using another DataFrame
get_norrec_pairs
([test_column])Return a dataframe that contains only valid normal-reciprocal pairs
import_crtomo
(directory[, frequency_file, ...])CRTomo importerLoad sEIT data from data directory.
import_eit_fzj
(filename, configfile[, ...])EIT data import for FZJ Medusa systems
import_mpt_das1
(filename[, timestep])Import MPT DAS-1 SIP data
import_sip256c
(filename[, settings, reciprocal])Radic SIP256c data import
merge_container
(container)Merge the data and electrode positions from another container into this one.
- import_crtomo(directory, frequency_file='frequencies.dat', data_prefix='volt_', no_norrec=False, **kwargs)[source]¶
CRTomo importerLoad sEIT data from data directory. This function loads data previously exported from reda using reda.exporters.crtomo.write_files_to_directory
- Parameters:
- directorystring
input directory
- frequency_filestring, optional
file (located in directory) that contains the frequencies
- data_prefix: string, optional
for each frequency a corresponding data file must be present in the input directory. Frequencies and files are matched by sorting the frequencies AND the filenames, retrieved using glob and the data_prefix
- Returns:
- dfpandas.DataFrame
A DataFrame suitable for the sEIT container
- electrodesNone
No electrode data is imported
- topographyNone
No topography data is imported
- import_eit_fzj(filename, configfile, correction_file=None, timestep=None, **kwargs)[source]¶
EIT data import for FZJ Medusa systems