Package Utils
Module Base
Module Decorator
- class pycsamt.utils.decorator.deprecated(reason)[source]
- Description:
used to mark functions, methods and classes deprecated, and prints warning message when it called decorators based on https://stackoverflow.com/a/40301488
- Usage:
todo: write usage
Date: 20/06/2017
Module Func-utils
- pycsamt.utils.func_utils.averageData(np_array, filter_order=0, axis_average=0, astype='float32')[source]
- Parameters
np_array (*) – must be an array data
filter_order (*) – must be the index of the column you want to sort
average (* axis) – axis you want to see data averaged, also it is the concatenate axis default is axis=0
astype* (*) – is the ndarray dtype array . change to have an outup arry dtype , you want .
- Returns
Data averaged array
- Return type
numpy array
:Example :
>>> import numpy as np >>> list8=[[4,2,0.1],[8,2,0.7],[10,1,0.18],[4,3,0.1], ... [7,2,1.2],[10,3,0.5],[10,1,0.5],[8.2,0,1.9], ... [10,7,0.5],[10,1,0.5], ... [2,0,1.4],[5,4,0.5],[10,2,0.7],[7,2,1.078], ... [10,2,3.5],[10,8,1.9]] >>> np_test=np.array(list8) >>> ss=averageData(np_array=np_test,filter_order=1, ... axis_average=0, astype="int") >>> ss
- pycsamt.utils.func_utils.broke_array_to_(arrayData, keyIndex=0, broken_type='dict')[source]
broke data array into different value with their same key
- Parameters
arrayData (*) – data array .
keyIndex (*) – index of column to create dict key
- Returns
dico_brok ,dictionnary of array.
- Return type
dict
- pycsamt.utils.func_utils.build_geochemistry_sample()[source]
Build geochemistry_sample_data
- Raises
Process to build geochemistry sample data manually . –
- Returns
Sample ,Geochemistry sample Data.
- Return type
np.ndarray
- Example
>>> geoch=build_geochemistry_sample() >>> print(geoch) ... sampleData ... [['S0X4' '0' '254.0' 'PUP'] ... ['S0X4' '254' '521.0' 'mg'] ... ['S0X4' '521' '625.0' 'tut'] ... ['S0X4' '625' '984.0' 'suj'] ... ['S0X2' '0' '19.0' 'pup'] ... ['S0X2' '19' '425.0' 'hut'] ... ['S0X2' '425' '510.0' 'mgt'] ... ['S0X2' '510' '923.2' 'pyt']]
- pycsamt.utils.func_utils.build_wellData(add_azimuth=False, utm_zone='49N', report_path=None, add_geochemistry_sample=False)[source]
- add_azimuthBool, optional
compute azimuth if add_azimut is set to True. The default is False.
- utm_zoneStr, optional
WGS84 utm_projection. set your zone if add_azimuth is turn to True. The default is “49N”.
- report_pathstr, optional
path to save your _well_report. The default is None. its match the current work directory
- add_geochemistry_sample: bool
- add_sample_data.Set to True if you want to add_mannually
Geochimistry data. default is False.
- Exception
manage the dimentionaly of ndarrays .
- OSError
when report_path is not found in your O.S.
- str
name of location of well .
- np.ndarray
WellData , data of build Wells .
- np.ndarray
GeolData , data of build geology.
- Example
>>> import numpy as np >>> import os, shutil >>> import warnings, >>> form _utils.avgpylog import AvgPyLog >>> well=build_wellData (add_azimuth=True, utm_zone="49N") >>> print("nameof locations
- :”,well[0])
>>> print("CollarData
- :”,well[1])
>>> print("GeolData
- :”, well[2])
… nameof locations … Shimen … CollarData … [[‘S01’ ‘477205.6935’ ‘2830978.218’ ‘987.25’ ‘-90’ ‘0.0’ ‘Shi01’ … ‘Wdanxl0’] … [‘S18’ ‘477915.4355’ ‘2830555.927’ ‘974.4’ ‘-90’ ‘2.111’ ‘Shi18’ … ‘Wdanxl0’]] … GeolData … [[‘S01’ ‘0.0’ ‘240.2’ ‘granite’] … [‘S01’ ‘240.2’ ‘256.4’ ‘ basalte’] … [‘S01’ ‘256.4’ ‘580.0’ ‘ granite’] … [‘S01’ ‘580.0’ ‘987.25’ ‘rock’] … [‘S18’ ‘0.0’ ‘110.3’ ‘sand’] … [‘S18’ ‘110.3’ ‘520.2’ ‘agrilite’] … [‘S18’ ‘520.2’ ‘631.3’ ‘ granite’] … [‘S18’ ‘631.3’ ‘974.4’ ‘ rock’]] … Shimen_wellReports_
- pycsamt.utils.func_utils.check_dimensionality(obj, data, z, x)[source]
Check dimensionality of data and fix it.
- Parameters
obj – Object, can be a class logged or else.
data – 2D grid data of ndarray (z, x) dimensions
z – array-like should be reduced along the row axis
x – arraylike should be reduced along the columns axis.
- pycsamt.utils.func_utils.compute_azimuth(easting, northing, utm_zone='49N', extrapolate=False)[source]
- Parameters
easting (*) – Easting value of coordinates _UTM_WGS84
northing (*) – Northing value of coordinates._UTM_WGS84
utm_zone (*) – the utm_zone . if None try to get is through gis.get_utm_zone(latitude, longitude). latitude and longitude must be on degree decimals. The default is “49N”.
extrapolate (*) –
for other purpose , user can extrapolate azimuth value, in order to get the sizesize as the easting and northing size. The the value will repositionate at each point data were collected.
Default is False as originally azimuth computation .
- Returns
azimuth.
- Return type
np.ndarray
- Example
>>> import numpy as np >>> import gis_tools as gis >>> easting=[477205.6935,477261.7258,477336.4355,477373.7903,477448.5, ... 477532.5484,477588.5806,477616.5968] >>> northing=[2830978.218, 2830944.879,2830900.427, 2830878.202,2830833.75, ... 2830783.742,2830750.403,2830733.734] >>> test=compute_azimuth(easting=np.array(easting), ... northing=np.array(northing), utm_zone="49N") >>> print(test)
- pycsamt.utils.func_utils.concat_array_from_list(list_of_array, concat_axis=0)[source]
Small function to concatenate a list with array contents
- Parameters
list_of_array (*) – contains a list for array data. the concatenation is possible if an index array have the same size
- Returns
numpy concatenated data
- Return type
array_like
- Example
>>> import numpy as np >>> np.random.seed(0) >>> ass=np.random.randn(10) >>> ass2=np.linspace(0,15,12) >>> ass=ass.reshape((ass.shape[0],1)) >>> ass2=ass2.reshape((ass2.shape[0],1)) >>> or_list=[ass,ass2] >>> ss_check_error=concat_array_from_list(list_of_array=or_list, ... concat_axis=0) >>> secont test : >>> ass=np.linspace(0,15,14) >>> ass2=np.random.randn(14) >>> ass=ass.reshape((ass.shape[0],1)) >>> ass2=ass2.reshape((ass2.shape[0],1)) >>> or_list=[ass,ass2] >>> ss=concat_array_from_list(list_of_array=or_list, concat_axis=0) >>> ss=concat_array_from_list(list_of_array=or_list, concat_axis=1) >>> ss >>> ss.shape
- pycsamt.utils.func_utils.convert_csvdata_from_fr_to_en(csv_fn, pf, destfile='pme.en.csv', savepath=None, delimiter=':')[source]
Translate variable data from french csva data to english with varibale parser file.
- Parameters
csv_fn – data collected in csv format
pf – parser file
destfile – str, Destination file, outputfile
savepath – [Path-Like object, save data to a path
- Example
# to execute this script, we need to import the two modules below >>> import os >>> import csv >>> path_pme_data = r’C:/UsersAdministratorDesktop__elodata >>> datalist=convert_csvdata_from_fr_to_en(
os.path.join( path_pme_data, _enuv2.csv’) , os.path.join(path_pme_data, pme.parserf.md’)
savefile = ‘pme.en.cv’)
- pycsamt.utils.func_utils.cpath(savepath=None, dpath=None)[source]
Control the existing path and create one of it does not exist. :param savepath: Pathlike obj, str :param dpath: str, default pathlike obj
- pycsamt.utils.func_utils.dump_comma(input_car, max_value=2, carType='mixed')[source]
- Parameters
input_car (*) – Input character.
max_value (*) – The default is 2.
carType (*) – Type of character , you want to entry
- Returns
must be return tuple of float value, or string value
- Return type
Tuple of input character
Note
carType may be as arguments parameters like [‘value’,’val’,”numeric”, “num”, “num”,”float”,”int”] or for pure character like
[“car”,”character”,”ch”,”char”,”str”, “mix”, “mixed”,”merge”,”mer”, “both”,”num&val”,”val&num&”] if not , can not possible to convert to float or integer. the defaut is mixed
- Example
>>> import numpy as np >>> ss=dump_comma(input_car=",car,box", max_value=3, ... carType="str") >>> print(ss) ... ('0', 'car', 'box')
- pycsamt.utils.func_utils.fr_en_parser(f, delimiter=':')[source]
Parse the translated data file.
- Parameters
f – translation file to parse
delimiter – str, delimiter
- Returns
generator obj, composed of a list of french and english Input translation.
- Example
>>> file_to_parse = 'pme.parserf.md' >>> path_pme_data = r'C:/Users\Administrator\Desktop\__elodata >>> data =list(BS.fr_en_parser( os.path.join(path_pme_data, file_to_parse)))
- pycsamt.utils.func_utils.geo_length_checker(main_param, optional_param, force=False, param_names=('input_resistivities', 'input_layers'), **kws)[source]
Geo checker is a function to check the differents length of different geoparams.
The length of optional params should depend of the length of main params. Therefore if the length of optional params is larger than the length of the main params, the length of optional params will be reduced to the length of main params.Otherwise if the length of optional params is shorther than the length of the main params, will filled it either with “None” if dtype param is string or 0. is float or 0 if integer. If force is set
True, shoud raise errors if the main params and the optional params have are not the same length.- Parameters
main_param (*) – main parameter that must took its length as reference length
params (* optional) – optional params, whom length depend to the length of main params
param_names (*) – names of main params and optional params so to generate error if exits.
fill_value (*) – Default value to fill thearray in the case where the length of optional param is less than the length of the main param .If None , will fill according to array dtype
- Returns
optional param truncated according to the man params
- Return type
array_like
- pycsamt.utils.func_utils.get_closest_value(values_range, input_value)[source]
Function to select the closest values when input values is not in the values range. We assume that value types are arrays. If the same value is repeated, should take the first index and the value at that index.
- Parameters
values_range (array_like) – values to get
input_value (float,) – specific value
- Returns
the closest value and its index
- Rtye
float
- pycsamt.utils.func_utils.intell_index(datalist, assembly_dials=False)[source]
function to search index to differency value to string element like geological rocks and geologicals samples. It check that value are sorted in ascending order.
- datalistlist
list of element : may contain value and rocks or sample .
- assembly_dialslist, optional
separate on two list : values and rocks or samples. The default is False.
- index: int
index of breaking up.
- first_dial: list ,
first sclice of value part
- secund_dial: list ,
second slice of rocks or sample part.
- assemblylist
list of first_dial and second_dial
- Example
>>> import numpy as np >>> listtest =[['DH_Hole', 'Thick01', 'Thick02', 'Thick03', ... 'Thick04','Rock01', 'Rock02', 'Rock03', 'Rock04'], ... ['S01', '0.0', '98.62776918', '204.7500461','420.0266651','520', 'GRT', ... 'ATRK', 'GRT', 'ROCK','GRANODIORITE'], ... ['S02', '174.4293956', '313.9043882','974.8945704', 'GRT', 'ATRK', 'GRT']] >>> listtest2=[listtest[1][1:],listtest[2][1:]] >>> for ii in listtest2 : >>> op=intell_index(datalist=ii) >>> print("index:
- “,op [0])
>>> print('firstDials :
- ‘,op [1])
>>> print('secondDials:
‘,op [2])
- pycsamt.utils.func_utils.interpol_scipy(x_value, y_value, x_new, kind='linear', plot=False, fill='extrapolate')[source]
function to interpolate data
- Parameters
x_value (*) – value on array data : original absciss
y_value (*) – value on array data : original coordinates (slope)
x_new (*) – new value of absciss you want to interpolate data
kind (*) –
- projection kind :
maybe : “linear”, “cubic”
fill (*) – kind of extraolation, if None , *spi will use constraint interpolation can be “extrapolate” to fill_value.
plot (*) – Set to True to see a wiewer graph
- Returns
y_new ,new function interplolate values .
- Return type
np.ndarray
- Example
>>> import numpy as np >>> fill="extrapolate" >>> x=np.linspace(0,15,10) >>> y=np.random.randn(10) >>> x_=np.linspace(0,20,15) >>> ss=interpol_Scipy(x_value=x, y_value=y, x_new=x_, kind="linear") >>> ss
- pycsamt.utils.func_utils.make_introspection(Obj, subObj)[source]
Make introspection by using the attributes of instance created to populate the new classes created. :param Obj: callable
New object to fully inherits of subObject attributes
- Parameters
subObj – Callable Instance created.
- pycsamt.utils.func_utils.minimum_parser_to_write_edi(edilines, parser='=')[source]
This fonction validates edifile for writing , string with egal. We assume that dictionnary in list will be for definemeasurment E and H fied.
- Parameters
edilines (list) – list of item to parse
parser (str) – the egal is use to parser edifile . can be changed, default is =
- pycsamt.utils.func_utils.parse_wellData(filename=None, include_azimuth=False, utm_zone='49N')[source]
Function to parse well information in*csv file
- filenamestr, optional
full path to parser file, The default is None.
- include_azimuth: bool ,
Way to compute azimuth automatically
- utm_zonestr,
set coordinate _utm_WGS84. Defaut is 49N
- FileNotFoundError
if typical file deoesnt match the *csv file.
- location: str
Name of location .
- WellDatanp.ndarray
Specificy the collar Data .
- GeoDatanp.ndarray
specify the geology data .
- SampleDataTYPE
geochemistry sample Data.
- Example
>>> import numpy as np >>> dir_=r"F:\OneDrive\Python\CodesExercices\ex_avgfiles\modules" >>> parse_=parse_wellData(filename='Drill&GeologydataT.csv') >>> print("NameOflocation:
- “,parse_[0])
>>> print("WellData:
- “,parse_[1])
>>> print("GeoData:
- “,parse_[2])
>>> print("Sample:
“,parse_[3])
- pycsamt.utils.func_utils.round_dipole_length(value, round_value=5.0)[source]
small function to graduate dipole length 5 to 5. Goes to be reality and simple computation .
- Parameters
value (float) – value of dipole length
- Returns
value of dipole length rounded 5 to 5
- Return type
float
- pycsamt.utils.func_utils.sPath(name_of_path: str)[source]
Savepath func. Create a path with name_of_path if path not exists. :param name_of_path: str, Path-like object. If path does not exist, name_of_path should be created.
- pycsamt.utils.func_utils.show_quick_edi_stats(nedic, nedir, fmtl='~', lenl=77)[source]
Format the Edi files and ckeck the number of edifiles successfully read. :param nedic: number of input or collected edifiles :param nedir: number of edifiles read sucessfully :param fmt: str to format the stats line :param lenl: length of line denileation.
- pycsamt.utils.func_utils.smart_format(iter_obj)[source]
Smart format iterable obj :param iter_obj: iterable obj
- Example
>>> from pycsamt.utils.func_utils import smart_format >>> smart_format(['model', 'iter', 'mesh', 'data']) ... 'model','iter','mesh' and 'data'
- pycsamt.utils.func_utils.sort_array_data(data, sort_order=0, concatenate=False, concat_axis_order=0)[source]
Function to sort array data and concatenate numpy.ndarray
- Parameters
data (*) – must be in simple array , list of array and dictionary whom the value is numpy.ndarray
sort_order (*) – index of colum to sort data. The default is 0.
concatenate (*) – concatenate all array in the object. Must be the same dimentional if concatenate is set to True. The default is False.
concat_axis_order (*) – must the axis of concatenation . The default is axis=0.
- Returns
data , Either the simple sort data or array sorted and concatenated .
- Return type
numpy.ndarray
- pycsamt.utils.func_utils.stn_check_split_type(data_lines)[source]
Read data_line and check for data line the presence of split_type < ‘,’ or ‘ ‘, or any other marks.> Threshold is assume to be third of total data length.
- Params data_lines
list of data to parse .
- Returns
The split _type
- Return type
str
- Example
>>> from pycsamt.utils import func_utils as func >>> path = os.path.join(os.environ["pyCSAMT"], 'csamtpy','data', K6.stn) >>> with open (path, 'r', encoding='utf8') as f : ... data= f.readlines() >>> print(func.stn_check_split_type(data_lines=data))
- pycsamt.utils.func_utils.straighten_out_list(main_list, list_to_straigh)[source]
- main_listlist
list of which the data must absolutely appear into the straighen list.in our case , it is the station list : a list of offset
- list_to_straighlist
- list contain the data (offset calculated,
the depth and the resistivity (log10)),
- list
the straighen list. some offset have been replaced by the offsets which are not in the main_list whithout change the lengh of the straighen list.
- Example
>>> import numpy as np >>> np.random.seed(14) >>> ss=np.random.randn(10)*12 >>> ss=ss.tolist() >>> ss=[round(float(jj),4) for jj in ss] >>> ss.sort() >>> red=np.random.randn(7)*12 >>> red=red.tolist() >>> test=[19, 15.012, 5.5821, 0.7234,3.1, ... 0.7919, 3.445, 4.7398, 5.1, 10.8, 15.51,21] >>> main=[20., 0.7234, 5, 3.445, 15.51,10.7, 3,5.1] >>> test.sort() >>> main.sort() >>> red=[round(float(ss),1) for ss in red] >>> print(test) >>> print(main) >>> sos=straighten_out_list (main_list=main , ... list_to_straigh=test) >>> print("sos:
“,sos)
- pycsamt.utils.func_utils.subprocess_module_installation(module, upgrade=True, DEVNULL=False, action=True, verbose=0, **subpkws)[source]
Install or uninstall a module using the subprocess under the hood.
- Parameters
module – str, module name
:param upgrade:bool, install the lastest version. :param verbose:output a message :param DEVNULL: decline the stdoutput the message in the console :param action: str, install or uninstall a module :param subpkws: additional subprocess keywords arguments.
- Example
>>> from pycsamt.utils.func_utils import subprocess_module_installation >>> subprocess_module_installation( 'tqdm', action ='install', DEVNULL=True, verbose =1) >>> subprocess_module_installation( 'tqdm', action ='uninstall', verbose =1)
- pycsamt.utils.func_utils.take_firstValue_offDepth(data_array, filter_order=1)[source]
- Parameters
data_array (*) – array of the data .
filter_order (*) – the column you want to filter. The default is 1.
- Returns
return array of the data filtered.
- Return type
array_like
- Example
>>> import numpy as np >>> list8=[[4,2,0.1],[8,2,0.7],[10,1,0.18],[4,3,0.1], ... [7,2,1.2],[10,3,0.5],[10,1,0.5],[8.2,0,1.9], ... [10,7,0.5],[10,1,0.5],[2,0,1.4],[5,4,0.5], ... [10,2,0.7],[7,2,1.078],[10,2,3.5],[10,8,1.9]] >>> test=np.array(list8) >>> print(np_test) >>> ss=take_firstValue_offDepth(data_array =np_test, filter_order=1) >>> ss=averageData(np_array=np_test,filter_order=1, >>> axis_average=0, astype="int") >>> print(ss)
- pycsamt.utils.func_utils.transfer_array_(data, index_key, start_value_depth, end_value_depth, column_order_selection=0, axis=0)[source]
- Parameters
data (*) – Dictionnary of numpy ndarray .
index_key (*) – key of the dictionnary . Must be a number of the first column of offset .
start_value_depth (*) – If the depth is not reach must add depth of the closest point. give the start value which match to the maxi depth of the data : The default is -214.
end_value_depth (*) – Maximum depth of the survey. The default is -904.
column_order_selection (*) – the index of depth column. The default is 0.
axis (*) – numpy.ndarray axis . The default is 0.
- Returns
return the array data we want to top to .
- Return type
numpy.ndarray
- Example
>>> import numpy as np >>> sos=abs(np.random.randn(4,3)*4) >>> sos2=abs(np.random.randn(4,3)*10.8) >>> print(sos2) >>> sis1=sort_array_data(data=sos,sort_order =1, ... concatenate=False, concat_axis_order=0) >>> sis2=sort_array_data(data=sos2,sort_order =1, ... concatenate=False, concat_axis_order=0) >>> dico={"18.4":sis1, ... "21.4":sis2} >>> test=transfer_array_(data=dico, index_key=11.4, ... start_value_depth=-14, end_value_depth=23, ... column_order_selection=1) >>> print("sis1:",sis1) >>> print("sis2:",sis2) >>> print("Finaltest", test)
Module Geo-utils
- pycsamt.utils.geo_utils.annotate_log(ax, thick, layers, *, ylims=None, colors=None, set_nul='*unknow', bbox_kws=None, set_nul_bbox_kws=None, **an_kws)[source]
Draw annotate stratigraphic map.
- Parameters
ax – obj, Matplotlib axis
thick – list of the thicknesses of the layers
layers – list of the name of layers
set_nul – str set the Name of the unknow layers. Default is `*unknow. Can be changed with any other layer name.
- :param bbox_kws:dict, Additional keywords arguments of Fancy boxstyle
arguments
- Parameters
set_nul_bbox_kws – dict, customize the boxstyle of the set_nul param. If you want the bbox to be the same like bbox_kws, we need just to write
idemor same` ororigin.- Returns
ax: matplotlib axis properties
- pycsamt.utils.geo_utils.assert_station(id, nm=None)[source]
Assert station according to the number of stations investigated.
- Parameters
id – int or str, station number. The station counter start from 01 as litteral count except whn provided value in string format following the letter S. For instance : S00 =1
nm – matrix of new stratiraphy model built.
- Returns
Index at specific station
- Example
>>> import pycsamt.utils.geo_utils as GU >>> import pycsamt.geodrill.geocore as GC >>> obj= GC.quick_read_geomodel() >>> GU.assert_station(id=47, nm=geoObj.nmSites) ...46
- pycsamt.utils.geo_utils.base_log(ax, thick, layers, *, ylims=None, hatch=None, color=None)[source]
Plot pseudo-stratigraphy basemap and return axis.
- Parameters
ax – obj, Matplotlib axis
thick – list of the thicknesses of the layers
layers – list of the name of layers
hatch – list of the layer patterns
color – list of the layer colors
- Returns
ax- matplotlib axis properties
- pycsamt.utils.geo_utils.display_s_infos(s_list, s_range, s_thick, **kws)[source]
Display strata infos at the requested station.
- Parameters
s_list – the pseudostratigraphic details list
s_range – the pseudostratigraphic strata range
s_thick – the pseudostratigraphic thicknesses
:param kws:additional keywords arguments.
- pycsamt.utils.geo_utils.fetching_data_from_repo(repo_file, savepath=None)[source]
Try to retreive data from github repository.
- Parameters
repo_file – str or Path-like object Give the full path from the repository root to the file name. For instance, we want to retrieve the file ‘AGSO.csv’ which is located in <pycsamt/geodrill/_geocodes> directory then the full path is: –> ‘pycsamt/geodrill/_geocodes/AGSO.csv’
- :return:`status`: Either ``False` for failed downloading
or
Truefor successfully downloading
- pycsamt.utils.geo_utils.find_distinct_items_and_indexes(items, cumsum=False)[source]
Find distincts times and their indexes.
- Parameters
items – list of items to get the distincts values
cumsum – bool, cummulative sum when items is a numerical values
- Returns
distinct _indexes unique indexes of distinct items
distinct_items: unik items in the list
cumsum: cumulative sum of numerical items
- Example
>>> import pycsamt.utils.geo_utils as GU >>> test_values = [2,2, 5, 8, 8, 8, 10, 12, 1, 1, 2, 3, 3,4, 4, 6] >>> ditems, dindexes, cumsum = GU.find_distinct_items_and_indexes( test_values, cumsum =True) >>> cumsum
- pycsamt.utils.geo_utils.fit_rocks(logS_array, lns_, tres_)[source]
Find the pseudo rock name at each station from the pseudovalue intres.
- Parameters
logS_array – array_like of under the station resistivity value
lns – array_like of the rocks or the pseudolayers (automatick)
tres – array_like of the TRES or the pseudo value of the TRES
- Returns
list of the unik corresponding resistivity value at each station and its fitting rock names.
- Example
>>> import pycsamt.utils.geo_utils as GU >>> import pycsamt.geodrill.geocore as GC >>> obj= GC.quick_read_geomodel() >>> pslns , pstres, ps_lnstres= GU.make_strata(obj) >>> logS1 =obj.nmSites[0] # station S0 >>> fit_rock(logS1, lns_= pslns, tres_= pstres)
- pycsamt.utils.geo_utils.fit_stratum_property(fittedrocks, z, site_tres)[source]
Separated whole blocks into different stratum and fit their corresponding property like depth and values of resistivities
- Parameters
fittedrocks – array_like of layers fitted from the TRES
z – array like of the depth
site_tres – array like of the station TRES
- Returns
s_grouped: Each stratum grouped from s_tres
site_tres_grouped: The site resistivity value site_tres grouped
z_grouped: The depth grouped (from the top to bottom )
z_cumsum_grouped: The cumulative sum grouped from the top to bottom
- Example
>>> import pycsamt.geodrill.geocore as GC >>> obj= GC.quick_read_geomodel() >>> logS1 = obj.nmSites[:, 0] >>> sg, stg, zg, zcg= fit_stratum_property ( obj.fitted_rocks, obj.z, obj.logS)
- pycsamt.utils.geo_utils.frame_top_to_bottom(top, bottom, data)[source]
Compute the value range between the top and the bottom.
- Find the main range value for plot ranged between the top model and
the bottom.
- Parameters
top – is the top value where plot might be started
bottom – is the bottom value where plot must end
data – is the list of thicknesses of each layers
cumsum_origin – is the list of cumul sum of the data
- Returns
- the index for other properties mapping. It indicates the
index of layer for the top and the index of layer for the bottom for visualizing.
- the list of pairs top-bottom , ex: [10, 999.0]
where tp -> 10 and bottom ->999. m
- the value of thicknesses ranged from the top to the bottom
For instance: [49.0, 150.0, 590.0, 200.0] where - 49 is the thockness of the first layer - 200 m is the thickness of the
- the coverall allows to track bug issues.The thickness of layer
for visualizing should be the same that shrank. Otherwise, the mapping was not successfully done. Therefore coverall will be different to 100% and function will return the raw data instead of raising errors.
- Example
>>> import pycsamt.utils.geo_utils as GU >>> layer_thicknesses = [ 59.0, 150.0, 590.0, 200.0] >>> top , bottom = 10, 120 # in meters >>> GU.frame_top_to_bottom( top = top, bottom =bottom, data = layer_thicknesses) ...(([0, 2], [10, 120], [49.0, 61.0]), 'coverall = 100.0 %')
- pycsamt.utils.geo_utils.get_agso_properties(config_file=None, orient='series')[source]
Get the geostructures files from <’pycsamt/geodrill/_geocodes’> and set the properties according to the desire type. When orient is
seriesit will return a dictionnary with key equal to properties name and values are the properties items.- Parameters
config_file – Path_Like or str Can be any property file provided hat its obey the disposal of property files found in __agso_properties.
orient – string value, (‘dict’, ‘list’, ‘series’, ‘split’, ‘records’, ‘’index’) Defines which dtype to convert Columns(series into).For example, ‘list’ would return a dictionary of lists with Key=Column name and Value=List (Converted series). For furthers details, please refer to https://www.geeksforgeeks.org/python-pandas-dataframe-to_dict/
- Example
>>> import pycsamt.utils.geo_utils as GU >>> data=GU.('pycsamt/geodrill/_geocodes/AGSO_STCODES.csv') >>> code_descr={key:value for key , value in zip (data["CODE"], data['__DESCRIPTION'])}
- pycsamt.utils.geo_utils.get_closest_gap(value, iter_obj, status='isin', condition_status=False, skip_value=0)[source]
Get the value from the minimum gap found between iterable values.
- Parameters
value – float Value to find its corresponding in the iter_obj
iter_obj – iterable obj Object to iterate in oder to find the index and the value that match the best value.
- :param condition_status:bool
If there is a condition to skip an existing value in the iter_obj, it should be set to
Trueand mention the ship_value.
- Parameters
skip_value – float or obj Value to skip existing in the iter_obj.
- :param status:str
If layer is in the databse, then get the electrical property and from that properties find the closest value in TRES If layer not in the database, then loop the database from the TRES and find the auto rock name from resistivity values in the TRES
- Returns
ix_close_res: close value with its index found in` iter_obj`
:rtype:tuple
- pycsamt.utils.geo_utils.get_index_for_mapping(ix, tp)[source]
get the index and set the stratpoint of the top or the endpoint of bottom from tuple list. The index should be used to map the o ther properties like color or hatches
- pycsamt.utils.geo_utils.get_s_thicknesses(grouped_z, grouped_s, display_s=True, station=None)[source]
Compute the thickness of each stratum from the grouped strata from the top to the bottom.
- Parameters
grouped_z – depth grouped according its TRES
grouped_s – strata grouped according to its TRES
s_display – bool, display infos in stdout
- Returns
thick : The thickness of each layers
strata: name of layers
- status: check whether the total thickness is equal to the
depth of investigation(doi). Iftrue: `coverall= 100% otherwise coverall is less which mean there is a missing layer which was not probably taking account.
- Example
>>> import pycsamt.geodrill.geocore as GC >>> obj= GC.quick_read_geomodel() >>> sg, _, zg, _= fit_stratum_property (obj.fitted_rocks, ... obj.z, obj.nmSites[:, 0] ) >>> get_s_thicknesses( zg, sg) ... ([13.0, 16.0, 260.0, 240.0, 470.0], ... ['*i', 'igneous rocks', 'granite', 'igneous rocks', 'granite'], ... 'coverall =100%')
- pycsamt.utils.geo_utils.grouped_items(items, dindexes, force=True)[source]
Grouped items with the same value from their corresponding indexes.
- Parameters
items – list of items for grouping.
dindexes – list of distinct indexes
force – bool, force the last value to broken into two lists. Forcing value to be broke is usefull when the items are string. Otherwise, force param should be
Falsewhen dealing numerical values.
- Returns
distinct items grouped
- Example
>>> import pycsamt.utils.geo_utils as GU >>> test_values = [2,2, 5, 8, 8, 8, 10, 12, 1, 1, 2, 3, 3,4, 4, 6] >>> dindexes,* _ = GU.find_distinct_items_and_indexes( test_values, cumsum =False) >>> GU.grouped_items( test_values, dindexes) ... [[2, 2], [5], [8, 8, 8], [10], [12], [1, 1], ... [2], [3, 3], [4, 4], [6]] >>> GU.grouped_items( test_values, dindexes, force =False) ... [[2, 2], [5], [8, 8, 8], [10], [12], [1, 1], [2], [3, 3], [4, 4, 6]]
- pycsamt.utils.geo_utils.lns_and_tres_split(ix, lns, tres)[source]
Indeed lns and tres from GeoStratigraphy model are updated.
Then splitting the lns and tres from the topped up values is necessary. Kind to resetting tres and `ln `back to original and return each split of inputting layers and TRES and the automatic rocks topped up during the NM construction.
- Parameters
ix – int Number of autorocks added
lns – list List of input layers
tres – list List of input resistivities values.
- pycsamt.utils.geo_utils.map_bottom(bottom, data, origin=None)[source]
Reduce the plot map from the top assumes to start at 0. to the bottom value.
- Parameters
bottom – float, is the bottom value from which the plot must be end
data – the list of layers thicknesses in meters
origin – The top value for plotting.by the default the origin takes 0. as the starting point
- Returns
- the mapping depth from the top to the maximum depth.
- the index indicated the endpoint of number of layer
for visualizing.
the list of pairs <top-bottom>, ex: [0, bottom]>
the value of thicknesses ranged from 0. to the bottom
- the coverall, which is the cumul sum of the value of
the thicknesses reduced compared to the total depth.
Note that to avoid raising errors, if coverall not equal to 100%, will return safety default values (original values).
- Example
>>> ex= [ 59.0, 150.0, 590.0, 200.0] >>> map_bottom(60, ex) ... ((2, [0.0, 60], [59.0, 1.0]), 'coverall = 100.0 %')
- pycsamt.utils.geo_utils.map_top(top, data, end=None)[source]
Reduce the plot map from the top value to the bottom assumed to be the maximum of investigation depth.
- Parameters
top – float, is the top value from which the plot must be starts
data – the list of layers thicknesses in meters
end – The maximum depth for plotting. Might be reduced, but the default takes the maximum depth investigation depth
- Returns
the mapping depth from the top to the maximum depth.
- the index indicated the number of layer for visualizing to
from the top to the max depth.
the list of pairs <top-bottom>, ex: [top, max depth]>
the value of thicknesses ranged from 0. to the bottom
- the coverall, which is the cumul sum of the value of
the thicknesses reduced compared to the total depth. It allows to track a bug issue.
Note that if coverall is different 100%, will return the default values giving values.
- Example
>>> import pycsamt.utils.geo_utils as GU >>> ex= [ 59.0, 150.0, 590.0, 200.0] # layers thicknesses >>> GU.map_top(60, ex) ... ((3, [60, 999.0], [149.0, 590.0, 200.0]), 'coverall = 100.0 %')
- pycsamt.utils.geo_utils.mapping_stratum(download_files=True)[source]
Map the rocks properties from _geocodes files and fit each rock to its properties.
- Parameters
download_files – bool Fetching data from repository if the geostrutures files are missing.
- Returns
Rocks and structures data in two diferent dictionnaries
- pycsamt.utils.geo_utils.print_running_line_prop(obj, inversion_software='Occam2D')[source]
print the file in stdout which is currently used ” for pseudostratigraphic plot when extracting station for the plot.
- pycsamt.utils.geo_utils.pseudostratigraphic_log(thick, layers, station, *, zoom=None, hatch=None, color=None, **annot_kws)[source]
Make the pseudostratigraphic log with annotate figure.
- Parameters
thick – list of the thicknesses of the layers
layers – list of the name of layers
hatch – list of the layer patterns
color – list of the layer colors
- Parm zoom
float, list. If float value is given, it considered as a zoom ratio and it should be ranged between 0 and 1. For isntance:
0.25 –> 25% plot start from 0. to max depth * 0.25 m.
Otherwise if values given are in the list, they should be composed of two items which are the top and bottom of the plot. For instance:
[10, 120] –> top =10m and bottom = 120 m.
- Note that if the length of zoom list is greater than 2,
the function will return all the plot and no errors should raised.
- Example
>>> from pycsamt.utils.geo_utils as GU >>> layers= ['$(i)$', 'granite', '$(i)$', 'granite'] >>> thicknesses= [59.0, 150.0, 590.0, 200.0] >>> hatch =['//.', '.--', '+++.', 'oo+.'] >>> color =[(0.5019607843137255, 0.0, 1.0), 'b', (0.8, 0.6, 1.), 'lime'] >>> GU.pseudostratigraphic_log (thicknesses, layers, hatch =hatch , ... color =color, station='S00') >>> GU.pseudostratigraphic_log ( thicknesses, layers, hatch =hatch, zoom =0.25, color =color, station='S00')
- pycsamt.utils.geo_utils.set_agso_properties(download_files=True)[source]
Set the rocks and their properties from inner files located in < ‘pycsamt/geodrill/_geocodes’> folder.
- pycsamt.utils.geo_utils.set_default_hatch_color_values(hatch, color, dhatch='.--', dcolor=(0.5019607843137255, 0.0, 1.0), force=False)[source]
Set the none hatch or color to their default values.
- Parameters
hatch – str or list of layer patterns
color – str or list of layers colors
dhatch – default hatch
dcolor – default color
force –
Return only single tuple values otherwise put the RGB tuple values in the list. For instance:
-if ``False`` color =[(0.5019607843137255, 0.0, 1.0)] - if ``True`` color = (0.5019607843137255, 0.0, 1.0)
- Example
>>> from pycsamt.utils.geo_utils as GU. >>> hatch =['//.', 'none', '+++.', None] >>> color =[(0.5019607843137255, 0.0, 1.0), None, (0.8, 0.6, 1.),'lime'] >>> GU.set_default_hatch_color_values(hatch, color))
- pycsamt.utils.geo_utils.smart_zoom(v)[source]
select the ratio or value for zooming. Don’t raise any error, just return the original size. No shrunk need to be apply when error occurs.
- Parameters
v –
str, float or iterable for zoom - str: 0.25% —> mean 25% view
1/4 —> means 25% view
iterable: [0, 120]–> the top starts a 0.m and bottom at 120.m
- note: terable should contains only the top value and the bottom
value.
- Returns
ratio float value of iteration list value including the the value range (top and the bottom values).
- Example
>>> import pycsamt.utils.geo_utils as GU >>> GU.smart_zoom ('1/4') ... 0.25 >>> GU.smart_zoom ([60, 20]) ... [20, 60]
- pycsamt.utils.geo_utils.subprocess_module_installation(module)[source]
Install module using subprocess. :param module: str, module name to install
- pycsamt.utils.geo_utils.zoom_processing(zoom, data, layers=None, hatches=None, colors=None)[source]
Zoom the necessary part of the plot.
If some optionals data are given such as hatches, colors, layers, they must be the same size like the data.
- Parameters
zoom –
float, list. If float value is given, it’s cnsidered as a zoom ratio than it should be ranged between 0 and 1. For isntance:
0.25 –> 25% plot start from 0. to max depth * 0.25 m.
Otherwise if values given are in the list, they should be composed of two items which are the top and bottom of the plot. For instance:
[10, 120] –> top =10m and bottom = 120 m.
Note that if the length of list is greater than 2, the function will return the entire plot and no errors should be raised.
data – list of composed data. It should be the thickness from the top to the bottom of the plot.
layers – optional, list of layers that fits the data
hatches – optional, list of hatches that correspond to the data
colors – optional, list of colors that fits the data
- Returns
top-botom pairs: list composed of top bottom values
new_thicknesses: new layers thicknesses computed from top to bottom
- other optional arguments shrunk to match the number of layers and
the name of exact layers at the depth.
- Example
>>> import pycsamt.utils.geo_utils as GU >>> layers= ['$(i)$', 'granite', '$(i)$', 'granite'] >>> thicknesses= [59.0, 150.0, 590.0, 200.0] >>> hatch =['//.', 'none', '+++.', None] >>> color =[(0.5019607843137255, 0.0, 1.0), None, (0.8, 0.6, 1.),'lime'] >>> GU.zoom_processing(zoom=0.5 , data= thicknesses, layers =layers, hatches =hatch, colors =color) ... ([0.0, 499.5], ... [59.0, 150.0, 290.5], ... ['$(i)$', 'granite', '$(i)$'], ... ['//.', 'none', '+++.'], ... [(0.5019607843137255, 0.0, 1.0), None, (0.8, 0.6, 1.0)])
Module Gis-tools
Module Property
Module Plot-utils
- pycsamt.utils.plot_utils.annotate_tip(layer_thickness, layer_names)[source]
A tip to group text with the same resistivities one layer when the layer are successively the same .
- Parameters
layer_thickness (array_like |list) – thickness of layer
layer_names (list or array_like) – names of layers , geological structures names
- Returns
v , layer thickness in depth
- Return type
array_like
- Returns
ni , list : name of layer
- Return type
array_like
- Example
>>> from pycsamt.utils import plot_utils as punc >>> rocks = ['Massive sulfide', 'Igneous rocks', 'Igneous rocks', 'Igneous rocks', 'Igneous rocks', 'Igneous rocks', 'Igneous rocks', 'Igneous rocks', 'Massive sulfide', 'Igneous rocks', 'Igneous rocks', 'Igneous rocks'] >>> resprops = [0.0, 49.0,69.0,89.0,109.0,129.0, 149.0,179.0,249.0,699.0,799.0,899.0] >>> thickness, lnames = punc.annotate_tip(layer_thickness=resprops, layer_names=rocks) >>>print(thickness) >>> print(lnames) >>> v, ni ... [24.5, 149.0, 474.0, 799.0] ... ['Massive sulfide', 'Igneous rocks', 'Massive sulfide', 'Igneous rocks']
- pycsamt.utils.plot_utils.average_rho_in_deep(dep_array, rho_array, step_descent)[source]
function to average rho in deep according to the value provided . In fact averaged rho in shorter depth distance allow us to understand the conductive zone. in approximately. The most conductive zone is detected as the zone with lower resistivities values . But fixing values as averaged rho , can build a specific strata that could match this zone .
- Parameters
dep_array (*) – the imaged depth (doi)
rho_array (*) – resistivity array
step_descent (*) – value to step descent
- Returns
rho average for each station # dep_averaged for each station
- Return type
array_like
- Example
>>> import numpy as np >>> from pycsamt.utils import plot_utils as punc >>> pseudo_depth=np.array([ 0. , 6. , 13. , 20. ,29. , 39., 49. , ... 59. , 69. , 89., 109. ,129., 149. ,179., ... 209. ,249. ,289., 339., 399., 459. ,529. ,609., ... 699., 799., 899., 999.]) >>> pseudo_depth = np.arange(0, 1220, 20) >>> rho = np.random.randn(len(pseudo_depth)) >>> rho_aver, dep_aver= average_rho_in_deep(dep_array=pseudo_depth, ... rho_array=rho, ... step_descent=20.) >>> rho_2,dep_2 = average_rho_in_deeper (dep_array= pseudo_depth, ... rho_array=rho, ... step_descent=1000) >>> print(pseudo_depth)
- pycsamt.utils.plot_utils.average_rho_in_deeper(dep_array, rho_array, step_descent)[source]
function to average rho in deep according to the value provided . In fact averaged rho in shorter depth distance allow us to understand the conductive zone. in approximately. The most conductive zone is detected as the zone with lower resistivities values . But fixing values as averaged rho , can build a specific strata that could match this zone .
- Parameters
dep_array (*) – the imaged depth (doi)
rho_array (*) – resistivity array
step_descent (*) – value to step descent
- Returns
rho average for each station # dep_averaged for each station
- Return type
array_like
- Example
>>> import numpy as np >>> from pycsamt.utils import plot_utils as punc >>> pseudo_depth=np.array([ 0. , 6. , 13. , 20. ,29. , 39., 49. , ... 59. , 69. , 89., 109. ,129., 149. ,179., ... 209. ,249. ,289., 339., 399., 459. ,529. ,609., ... 699., 799., 899., 999.]) >>> pseudo_depth = np.arange(0, 1220, 20) >>> rho = np.random.randn(len(pseudo_depth)) >>> rho_aver, dep_aver= average_rho_in_deep(dep_array=pseudo_depth, ... rho_array=rho, ... step_descent=20.) >>> rho_2,dep_2 = average_rho_in_deeper (dep_array= pseudo_depth, ... rho_array=rho, ... step_descent=1000) >>> print(pseudo_depth)
- pycsamt.utils.plot_utils.average_rho_with_locals_minmax(array)[source]
How to compute mean value between local maxima and local minima and keep locals minima and maxima value on the final data
- Parameters
array (array_like) – data to compute the local minima and local maxima
- Returns
array mean with data local value averaged
- Return type
array_like
- Example
>>> from pycsamt.utils import plot_utils as punc >>> mean1= punc.average_rho_with_locals_minmax(tth[0]) >>> mean2= punc.average_rho_with_locals_minmax(tth[1]) >>> print(mean1) >>> print(mean2)
- pycsamt.utils.plot_utils.build_new_station_id(station_id, new_station_name)[source]
Fonction to build new station id including station name provided , if the length provided
doesnt match the length of station id
- Parameters
id (station) – new sites names
mess (str) – message for debugging, Default is None
- Example
>>> from pycsamt.utils import plot_utils as punc >>> ts =[ 28., 200., 400., 600., 800., 1000., 1200., 1400., 1600., 1800., 1807.] >>> sto = ['S{0}'.format(i) for i in range(7)] >>> print(sto) >>> stn, fu =punc.build_new_station_id(station_id = sto, new_station_name =ts) >>> print(stn, fu)
- pycsamt.utils.plot_utils.build_resistivity_barplot(depth_values, res_values)[source]
Allow to build bar plot resistivity function of investigation depth .
- Parameters
depth_values (*) – model investigation depth
res_values (*) – model_resistivities at each depth values
- Returns
d (array_like) – resistivity barplot depth .
r (array_like) – specific structure resistivities
sumd (float) – checker number that cover in fact the total depth. this numbe must absolutely match the total depth .
- pycsamt.utils.plot_utils.controle_delineate_curve(res_deline=None, phase_deline=None)[source]
fonction to controle delineate value given and return value ceilling .
- Parameters
res_deline (float|int|list) – resistivity value todelineate. unit of Res in ohm.m
phase_deline (float|int|list) – phase value to delineate , unit of phase in degree
- Returns
delineate resistivity or phase values
- Return type
array_like
- pycsamt.utils.plot_utils.delineate_curve(dict_loc, value, atol=0.2, replace_value=nan)[source]
function to delineate value of rho and phase .
- Parameters
dict_loc (dict) – dictionnary composed of keys = stations id and values
value (float |list) – value to delineate curve . for single value.
atol (float) – tolerance parameter <=1 . Most the param is closest to 0 , most the selected data become severe.default is 0.2
replace_value (float or else) – could be None or np.nan , Default is np.nan
- Returns
dict of delineate data
- Return type
dict
- Example
>>> from pycsamt.utils import plot_utils as punc >>> ts = np.array([0.1, 0.7, 2, 3, 8, 1000, 58,55, 85, 18]) >>> to =np.array([51, 78, 0.25, 188, 256, 7]) >>> tt ={'S00': ts, 'S01':to, 'S02': np.array([0, 5, 125, 789])} >>> print(punc.delineate_curve(dict_loc = tt, value=[50,70], atol = 0.1))
- pycsamt.utils.plot_utils.delineate_sparseMatrix(dict_loc, delineate_dict, replace_value=nan)[source]
Build from delineate dict a matrix according to frequency length . value doesnt exist in the delineate dict will be repalce by replacevalue . Default is nan.
- Parameters
delineate_dict (dict) – delineation value
dict_loc (dict) – dictionnary composed of keys = stations id and values
replace_value (float) – value to replece other value like build a sparse matrix
- Returns
dit of sparse matrix
- Return type
dict
- pycsamt.utils.plot_utils.depth_of_investigation(doi)[source]
Depth of investigation converter
- Parameters
doi (str|float) – depth of investigation if value float is provided , it will considered as default units in meter
:returns doi:value in meter :rtype: float
- pycsamt.utils.plot_utils.find_closest_station(offset_indice, model_offsets, site_offsets)[source]
Get the indice of the closest offset
- Parameters
offset_indice (*) – if the indix of the offset at the selected resistivity point.
model_offset (*) – is a large band of x_nodes resistivities gnerated by mesh files
sites_offsets (*) – the data set offset from Occam Data file
- Returns
indexoff (int) – index of data offset
get_offs (float) – value of the offset at that index
- pycsamt.utils.plot_utils.find_local_maxima_minima(array)[source]
function to find minimum local and maximum local on array
- Parameters
data (array_like) – value of array to find minima , maxima
- Returns
tuple of index of minima and maxima local index and array of minima maxima value
- Return type
array_like
- Example
>>> from pycsamt.utils import func_utils as func >>> from pycsamt.utils import plot_utils as punc >>> ts =np.array([2, 3, 4, 7, 9, 0.25, 18, 28, 86, 10, 5]) >>> te=np.array([0.2, .3, 18, 1.6, 0.2, 0.6, 0.7, 0.8, 0.9, 1., 23.]) >>> th =func.concat_array_from_list([ts, te], concat_axis=1) .. tth =th.T ... print(tth) ... print(punc.find_local_maxima_minima(tth[0]))
- pycsamt.utils.plot_utils.find_path(path=None, ptol=0.7)[source]
check path and return filepath , edipath or jpath .
- Parameters
path (str) – full path to edi, avag or j file or directory
ptol (float) – tolerance that given by the program to judge if the number of typical file [EDI|J] to declare as path found is either “edipath” or “jpath” if none ,return None . less or equal to 1.
- Returns
specific path
- Return type
str
- pycsamt.utils.plot_utils.fmt_text(data_text, fmt='~', leftspace=3, return_to_line=77)[source]
Allow to format report with data text , fm and leftspace
- Parameters
data_text (str) – a long text
fmt (str) – type of underline text
leftspae (int) – How many space do you want before starting wrinting report .
return_to_line (int) – number of character to return to line
- pycsamt.utils.plot_utils.get_conductive_and_resistive_zone(data, site_names, purpose='groundwater', **kws)[source]
function to get the probability of conductive and resistive zone . It is not absolutely True but give an overview of decison .
It is not sufficient to declare that the zone is
favorable for any drill , but just work with probability
- Parameters
data (ndarray) – resistivity datata of survey area
site_name (list) – list of sites names
purpose (str) – type of exploration , default is groundwater
- Returns
report of exploration area
- Return type
str
- pycsamt.utils.plot_utils.get_frequency_id(freq_array, frequency_id)[source]
function to get id of frequency . Frequency to plot
- Parameters
freq_array (nd.array,1) – array of frequency
frequency_id (list or float) – frequency to plot .
- Returns
new close frequency id
- Return type
float|list
- pycsamt.utils.plot_utils.get_station_id_input_resistivities(station_rho_value, number_of_layer=None)[source]
Get a special station input resistivities is much benefit and more close to reality of plot . Indeeed , it take only the maximum value of resistivities below the site and the minimum , then cut out 7 Considering all the model data and choose the max resistivities and the
minim resistivities to build automatic resistivities whom COULD match the deth is less sure .Geeting a input resitivities to aplom the site , give a merly and better interpretation.
- Parameters
station_rho_value (array_like) – value of resistivities under the site thin the maximum depth
number_of_layer (int) – number of layer to top to bottom.
- pycsamt.utils.plot_utils.get_stationid(stations, station_id)[source]
Tip to get station id from user by input either integer or station name .
- Parameters
stations (list) – list of stations known
station_id (list, str, or int) – staion expect to plot.
- Returns
constructed list for plotting
- Return type
array_like
- Example
>>> from pycsamt.utils import plot_utils as punc >>> teslist = ['S{0:02}'.format(ii) for ii in range(23)] >>> ss = punc.get_stationid (stations=teslist , station_id=('S04',13)) >>> print(ss)
- pycsamt.utils.plot_utils.getcloser_frequency(freq_array, frequency_id)[source]
chek whether the frequency value given is in frequency range if not found the closest value
- pycsamt.utils.plot_utils.plot_errorbar(ax, x_array, y_array, y_error=None, x_error=None, color='k', marker='x', ms=2, ls=':', lw=1, e_capsize=2, e_capthick=0.5, picker=None, **kws)[source]
convinience function to make an error bar instance @author: jpeacock-pr
- axmatplotlib.axes instance
axes to put error bar plot on
- x_arraynp.ndarray(nx)
array of x values to plot
- y_arraynp.ndarray(nx)
array of y values to plot
- y_errornp.ndarray(nx)
array of errors in y-direction to plot
- x_errornp.ndarray(ns)
array of error in x-direction to plot
- colorstring or (r, g, b)
color of marker, line and error bar
- markerstring
marker type to plot data as
- msfloat
size of marker
- lsstring
line style between markers
- lwfloat
width of line between markers
- e_capsizefloat
size of error bar cap
- e_capthickfloat
thickness of error bar cap
- pickerfloat
radius in points to be able to pick a point.
- errorbar_objectmatplotlib.Axes.errorbar
error bar object containing line data, errorbars, etc.
- pycsamt.utils.plot_utils.resetting_colorbar_bound(cbmax, cbmin, number_of_ticks=5, logscale=False)[source]
Function to reset colorbar ticks more easy to read
- Parameters
cbmax (float) – value maximum of colorbar
cbmin (float minimum data value) – minimum data value
number_of_ticks (int) – number of ticks should be located on the color bar . Default is 5.
logscale (bool) – set to True if your data are lograith data .
- Returns
array of color bar ticks value.
- Return type
array_like
- pycsamt.utils.plot_utils.resetting_ticks(get_xyticks, number_of_ticks=None)[source]
resetting xyticks modulo , 100
- Parameters
get_xyticks (list) – xyticks list , use to ax.get_x|yticks()
number_of_ticks (int) – maybe the number of ticks on x or y axis
- Returns
a new_list or ndarray
- Return type
list or array_like
Function to set properties for each plot. Easy to customize line and markers. Function can add other properties which are not in kwargs.keys(). It will set according the number of subplotsplots we assume subplot are define on one columns
- Parameters
number_of_plot (int) – number of subsplot you want show.
- Returns
dictionarry of labels and properties.
- Return type
dict
- pycsamt.utils.plot_utils.slice_csamt_matrix(block_matrix, station_offsets, depth_offsets, offset_MinMax=(0, 1000), doi='2000m')[source]
Using Wannamaker FE elements mesh to define rho matrix blocks , need after inversion to slice the model resistivity according the offset and depth we need . This function is easy tool to slice matrix and to keep the part we need . station offset , depth and model resistivity
- Parameters
block_matrix (*) – matrix of station depth Resistivity model depth_offsets.shape[0])
depth_offset (*) – depth of investigation after generating by mesh file :>z_nodes .
station_offsets (*) – station _offsets : offset generate by mesh_file :>x_nodes .
offset_MinMax (*) –
- the interval of data to keep . eg if station location start by 0 :
off[0] = min and off[-1]=max (min, max):–> index 0 : minimum value of station location –>index 1 :
maximum value of station location
default is (0,1000)
doi (*) – investigation depth , migth be [m|km]. If value is provided is float number , it might take value as a default unit ‘meter’. i.e : 1000=”1000m”
- Returns
new sliced station offset , new sliced depth offset , new_matrix block ,
- Return type
tuple
- pycsamt.utils.plot_utils.slice_matrix(base_matrix, freq_array, doi=2000)[source]
Function get a matrix and give new matrice slice from limit value
- Parameters
base_matrix (ndarray) – arrays (yaxis lenghth, station_length)
freq_array (ndarray,1) – frequency array range
doi – expect to be the depth of investigation from which data muts be selected in m or km
:type doi:float
- Returns
matrix sliced according to doi
- Return type
ndarray
- pycsamt.utils.plot_utils.station_id(id_)[source]
From id get the station name as input and return index id. Index starts at 0.
- Parameters
id – name of the station or index . Be sure to have the station name containing the letter S which mean site.
- Returns
station index. If the list id_ is given will return the tuple.
Module Z-Calculator
- pycsamt.utils.zcalculator.comp_phz(comphz_array, units='deg')[source]
PHZc are from each data block, units in rad
- Parameters
comphz_array (float) – average parameters phase for data blocs.
- Returns
component phase averaged.
- Return type
component phase averaged.
- Example
>>> path = os.path.join(os.environ["pyCSAMT"], ... 'csamtpy','data', 'K1.AVG') >>> from pycsamt.core import avg >>> phs_obj =avg.Phase(path) >>> phs_obj.loc['S00'] >>> value, ss = comp_phz(comphz_array=phs_obj.loc[ ... 'S00'], to_degree=True) ... print(value)
- pycsamt.utils.zcalculator.comp_rho(mag_E_field, mag_H_field, freq_array, A_spacing, Txcurr)[source]
Function to compute component average unit in in ohm.m
- Parameters
mag_E_field (np.ndarray(ndarray,1)) – magnitude of E-filed , averaged
mag_H_field (np.ndarray(ndarray,1)) – magnitude of H-Field , averaged
freq_array (np.ndarray(ndarray,1)) – frequency of station field
A_spacing (np.float) – step_between station
Txcurr (np.float,) – distance of coil in meter
- Returns
comp_rho , component averaged rho.
- Return type
np.ndarray
- pycsamt.utils.zcalculator.compute_AMA(reference_freq=None, z_array=None, number_of_skin_depth=1.0, dipole_length=50.0, **kwargs)[source]
Use an adaptive-moving-average filter to estimate average apparent resistivities at a single static-correction-reference frequency. Adaptive filtering is based on ideas presented inTorres-Verdin and Bostick, 1992, Principles of spatial surface electric field filtering in magnetotellurics -electromagnetic array profiling (EMAP), Geophysics, v57, p603-622.
- Parameters
reference_frequency (float) – frequency with clean data in Hertz
z_array (arry_like, complex) – array of uncorrected impedance values.
dipole_length (float) – length of dipole on survey
number_of_skin_depth (int , default is 1.) – arbitrary real constant, can be changed to any value between 1 and 10 skin depths, by experiency, value shoulb be 1<= c <= 4
weighted_window (array_like) – bandwidth of hanning window filter lengths, skin_depth arrays at each station.
app_rho (array_like) – array of apparent resistivities in ohm.m , if not provided will use impedance zrho to compute app_rho with reference_frequency
- Returns
windowed hanning , filtered window.
- Return type
array_like
Note
If resistivities array is provided, provided also uncorrected phase array to compute impedance array.
- Example
>>> from pycsamt.utils import zcalculator as Zcc >>> z1= np.array([2.46073791 +3.00162006j , ... 9.74193019 +1.82209497j, ... 15.68879141 + 12.91164264j , ... 5.84384925 +3.6899018j, ... 2.4430065 +0.57175607j]) ... >>> reference_frequency = 8192. >>> znew= compute_AMA(reference_frequency=8192., ... number_of_skin_depth= 1., dipole_length =50., ... z_array=z1) ... print(znew)
- pycsamt.utils.zcalculator.compute_FLMA(z_array=None, weighted_window=None, dipole_length=50.0, number_of_points=5.0, **kwargs)[source]
Use a fixed-length-moving-average filter to estimate average apparent resistivities at a single static-correction-reference frequency
- Parameters
z_array (arry_like, complex) – array of uncorrected impedance values.
dipole_length (float) – length of dipole on survey
number_of_points (int) – survey point or number point to apply.
weighted_window (array_like) – bandwidth of hanning window filter lengths, skin_depth arrays at each station.
app_rho (array_like) – array of apparent resistivities in ohm.m , if not provided will use impedance zrho to compute app_rho with reference_frequency
- Returns
windowed hanning , filtered window.
- Return type
array_like
- Example
>>> from pycsamt.utils import zcalculator as Zcc >>> z1= np.array([2.46073791 +3.00162006j , ... 9.74193019 +1.82209497j, ... 15.68879141 + 12.91164264j , ... 5.84384925 +3.6899018j, ... 2.4430065 +0.57175607j]) >>> flma= Zcc.compute_FLMA(z_array=z1, dipole_length=50. , number_of_points=4) >>> print(flma)
- pycsamt.utils.zcalculator.compute_TMA(data_array=None, number_of_TMApoints=5.0)[source]
function to compute a trimmed-moving-average filter to estimate average apparent resistivities.
- Parameters
data_array (array_like(ndarray,1)) – content of value to be trimmed
points (number_of_TMA) – number of filter points .
- Returns
value corrected with TMA
- Return type
array_like (ndarray, 1)
- Example
>>> from pycsamt.utils import zcalculator as Zcc >>> z2 = np.array([2.46073791 , 3.00162006 , ... 9.74193019 ])# 1.82209497, ... # 15.68879141 , 12.91164264 , ... # 5.84384925 , 3.6899018, ... # 2.4430065 ,0.57175607]) >>> tma= Zcc.compute_TMA(data_array=z2, ... number_of_TMApoints= 7) ... print(tma)
- pycsamt.utils.zcalculator.compute_adaptative_moving_average(z_array=None, weighted_window=None, dipole_length=None, number_of_points=None)[source]
Note
see compute_AMA !
- pycsamt.utils.zcalculator.compute_components_Z_Phz(magn_E_field, magn_H_field, phz_E_field, phz_H_field, freq_value, **kwargs)[source]
Function to compute all components derived from Impedance Z. user can enter specifik units in kwargs arguments . program will compute and converts value automatically.
- Parameters
magn_E_field (*) – E_.field magnitude (ndarray,1) in microV/KM*A
magn_H_field (*) – H_.field magnitude (ndarray,1)in mGammas/A or picoTesla/A
phz_E_field (*) – E_field phase (ndarray, 1) in mrad
phz_H_field (*) – H_field phase (ndarray,1) in mrad.
freq_value (*) – Frequency at which data was measured(ndarray,1)in Hz
kwargs (*) – units conversion.
- Raises
CSex.pyCSAMTError_z(), – Exceptions if units entered by the user doesnt match or are messy.
- Returns
rho (ndarray) – Cagnard resistivity calculation. ohm.m
phz (ndarray) – Impedance phase value.
Zij (ndarray) – Impedance Tensor value.
Zreal (ndarray) – Value of Real part of impedance Tensor.
Zimag (float) – Value of Imaginary part of impedance Tensor.
Zreal_imag (ndarray , complex) – Complex value of impedance Tensor.
- Example
>>> from pycsamt.utils import zcalculator as Zcc >>> from pycsamt.core import avg >>> path = os.path.join(os.environ["pyCSAMT"], ... data', 'avg', 'K1.AVG') >>> emag_ob = avg.Emag(path) >>> hmag_obj = avg.Hmag(path) >>> ephz_obj = avg.Ephz(path) >>> hphz_obj = avg.Hphz(path) >>> freq_obj =avg.Frequency(path) >>> station_name ='S00' >>> rho, phz, Z, real, imag, comp =Zcc.compute_components_Z_Phz( ... magn_E_field=emag_ob.loc[station_name], ... magn_H_field =hmag_obj.loc[station_name], ... phz_E_field =ephz_obj.loc[station_name], ... phz_H_field=hphz_obj.loc[station_name], ... freq_value=freq_obj.loc[station_name]) ... rho
- pycsamt.utils.zcalculator.compute_sigmas_e_h_and_sigma_rho(pc_emag, pc_hmag, pc_app_rho, app_rho, emag, hmag)[source]
function to compute Standard Deviation for E-field (sigma_e), Standard Deviation for H-Field (sigma_h) , & Standard Deviation for Component RHO (sigma_rho)
- Parameters
pc_emag (*) – Statistical variation of magnitude values from averaged data blocks. Standard Deviation/Average Emag (%)
pc_hmag (*) – Statistical variation of magnitude values from averaged data blocks. Standard Deviation / Average Hmag (%)
pc_app_rho (*) – Statistical variation of magnitude values from averaged data blocks. Standard Deviation / Average Rho (%)
app_rho (*) – resistivity calculated from averaged component (ohm.m)
Emag (*) – average E - field magnitude(microVolt/Km *amp )
Hmag (*) – average H - field magnitude(pTesta/amp) or (milliGammas/Amp)
- Returns
sigma_rho (float) – srhoC (Standard Deviation for Component RHO)
c_var_Rho (float) – C-varrhoC( Coefficient of Variation for Component RHO)
- pycsamt.utils.zcalculator.compute_trimming_moving_average(data_array=None, number_of_TMApoints=5.0)[source]
function to compute a trimmed-moving-average filter to estimate average apparent resistivities.
- Parameters
data_array (array_like(ndarray,1)) – content of value to be trimmed
points (number_of_TMA) – number of filter points .
- Returns
value corrected with TMA
- Return type
array_like (ndarray, 1)
- Example
>>> from pycsamt.utils import zcalculator as Zcc >>> z2 = np.array([2.46073791 , 3.00162006 , ... 9.74193019 ])# 1.82209497, ... # 15.68879141 , 12.91164264 , ... # 5.84384925 , 3.6899018, ... # 2.4430065 ,0.57175607]) >>> tma= Zcc.compute_TMA(data_array=z2, ... number_of_TMApoints= 7) ... print(tma)
- pycsamt.utils.zcalculator.compute_weight_factor_betaj(Xpos, dipole_length=50.0, number_of_points=5.0, window_width=None)[source]
weight Beta is computed following the paper of Torres-verdfn, C., and F. X. Bostick, 1992,Principles of spatial surface electric field
filtering in magnetotellurics - Electromagnetic
array profiling ( EMAP )- Geophysics, 57(4), 25–34.
- Parameters
Xpos (str) – reference position on the field
dipole_length (float) – length of dipole measurement
number_of_points (int) – point to stand filters , windowed width
- pycsamt.utils.zcalculator.compute_zxy_xk_omega(z_imp, coeffs_bj)[source]
Compute adaptative impedance with variable length Hanning window :param z_imp: impedance value to be filtered :type z_imp: complex
- Parameters
coeff_bj – list coefficients of weighted window at each stations
:type coeffs_bj : list
- Returns
array of new impedance filtered
- Return type
complex
- Example
>>> from pycsamt.utils import zcalculator as Zcc >>> z1= np.array([2.46073791 +3.00162006j , ... 9.74193019 +1.82209497j, ... 15.68879141 + 12.91164264j , ... 5.84384925 +3.6899018j, ... 2.4430065 +0.57175607j]) >>> weight_betaj = [array([0.18169011, 0.81830989]), ... array([0.02492092, 0.25, 0.47507908, 0.25]), ... array([0.00224272, 0.02771308, 0.09220631, 0.16554531, 0.21341394, ... 0.21341394, 0.16554531, 0.09220631, 0.02771308]), ... array([0.05766889, 0.47116556, 0.47116556]), ... array([1.])] >>> Zcc.compute_zxy_xk_omega(coeffs_bj=weight_betaj , z_imp=z1) ... [2.01364616+2.45625537j 9.16556955+4.84395488j 6.83942027+4.21606008j ... 4.80923612+2.75254645j 2.4430065 +0.57175607j]
- pycsamt.utils.zcalculator.dipole_center_position(dipole_position=None)[source]
Generaly positions are taken at each electrode of dipole to that to easy correct data for ploting and for noise correction , we adjust coordinate by taking the center position that means , the number of points will be substract to one.
- Parameters
dipole_position (array_like) – postion array at each electrodes.
- Returns
centered position value array
- Return type
array_like
- pycsamt.utils.zcalculator.find_reference_frequency(freq_array=None, reffreq_value=None, sharp=False, etching=True)[source]
Method to find and interpolate reference value if it is not present on the frequency range.
- Parameters
freq_array (array_like) – array_like frequency range
reffreq_value (float or int) – reference frequency value
sharp (bool) – if set to True , it forces the program to find mainly a value closest inside the frequency range.
etching (bool) – bool , if set to True , it will print in your stdout.
- Returns
reference frequency
- Return type
float
- pycsamt.utils.zcalculator.get_array_from_reffreq(array_loc, freq_array, reffreq_value, stnNames=None)[source]
Get array value at special frequency :param * array_loc: dictionnary of stations , array_value e.g: S00:(ndarray,1)
rho_values
- Parameters
freq_array (*) – frequency array for CSAMT survey
reffreq_value (*) – the value of frequency user want to get the value
stnNames (*) – list of stations names .
- Returns
an array of all station with reffreq_value . e.g reffreq_value =1024. it return all value of the array at 1024Hz frequency .
- Return type
array_like
- pycsamt.utils.zcalculator.get_data_from_reference_frequency(array_loc, freq_array, reffreq_value)[source]
Function to get reference frequency without call especially stations array. The function is profitable but It’s less expensive However if something wrong happened by using the first step to get a reference array , it will try the traditionnally function to get it. If none value is found , an Error will occurs.
- Parameters
array_loc (dict) – assume to be a dictionnary of stations_data_values.
freq_array (array_like) – frequency array
reffreq_value (float or int) – reffrence value, If the reference value is not in frequency array function will force to interpolate value and find the correlative array.
- Returns
an array of reference value at specific index
- Return type
array_like
- Example
>>> get_data_from_reference_frequency(array_loc=rho,freq_array=freq_array, ... reffreq_value=1023.) ... Input reference frequency has been interpolated to < 1024.0 > Hz
- pycsamt.utils.zcalculator.get_matrix_from_dict(dict_array, flip_freq=False, freq_array=None, transpose=False)[source]
Function to collect dictionnary station data with values as array and build matrix along the line, The rowlines is assumed to be frequency and colums as stations names. If freq_array is provided , flip_freq is not usefull.
- Parameters
dict_array (dict) – stations dictionnary array, keys are stations names and values are stations values on array_like.
transpose (bool, optional) – transpose matrix , if true wwill transpose data and stations should be read as rowlines and frequency as columns. The default is False.
freq_array (array , optional) – array of frequency, if provided will check if frequency are range from highest to lowest .Defalut is True
flip_freq (bool, optional) –
- set to false if you want frequency to be lowest to highest otherwise
frequency are sorted Highest to lowest. Default is False
- Returns
ndarray(len(stations,), len(frequency)) – matrix of dictionnary values
bool, – flip_freq, ascertain if frequency array is flipped or not.
- pycsamt.utils.zcalculator.get_reffreq_index(freq_array, reffreq_value)[source]
Get the index of reference index. From this index, All array will filter data at this reffreq value . :param freq_array: array of frequency values :type freq_array: array_like
- Parameters
reffreq_value (float, int) – value of frequency at clean data
- pycsamt.utils.zcalculator.hanning(dipole_length=50.0, number_of_points=7, large_band=False)[source]
Function to compute hanning window .
- Parameters
dipole_length (float) – the length of dipole , xk is centered between dipole
number_of_points (int) – number of filter points
- Returns
windowed hanning
- Return type
array_like
- pycsamt.utils.zcalculator.hanning_x(x_point_value, dipole_length=50.0, number_of_points=7, bandwidth_values=False, on_half=True)[source]
Function to compute point on window width . Use discrete computing . Function show the value at center point of window assume that the point is center locate on the window width . It intergrates value between dipole length. User can use see_extraband to see the values on the total bandwith. If half is False the value of greater than center point will be computed and not be 0 as the normal definition of Hanning window filter.
- Parameters
x_point_value (float) – value to intergrate.
dipole_length (float) – length of dipole on survey
number_of_point (int) – survey point or number point to apply.
bandwidth_values – see all value on the bandwith, value greater than x_center point will be computed .
:type bandwidth_values:bool
- Parameters
on_half (bool) – value on the bandwith; value greater that x_center point = 0.
- Returns
hannx integrated X_point_value or array of window bandwidth .
- Return type
array_like
- pycsamt.utils.zcalculator.hanning_xk(dipole_length=50.0, number_of_points=7)[source]
- compute _hanning window on a wtdth of number of point :
integrate value on all the window_bandwidth discrete and continue. if value is greater than Hald of the width value == 0 .
- Parameters
dipole_length (float) – length of dipole
number_of_points (int) – value of points or survey stations .
- Returns
han_xk , continue value on half bandwidth x0– xk (center point)
- Return type
array_like
- Returns
windowed hanning, discrete _value ,SUM(han(x0, xk))
- Return type
array_like
- pycsamt.utils.zcalculator.interpolate_sets(array_to, fill_value=None, array_size=None)[source]
Function to interpolate data contain of multiple nan values.
- pycsamt.utils.zcalculator.mag_avg(mag_array, A_spacing, Txcur)[source]
- RAW, E-, or H-field magnitude values)for each frequency
units : mV/Km*
- Parameters
mag_array (np.array (ndarray, 1),) – magnnitude value for each data block
a_spacing (float) – dipole length
txcur – curv coil, transmitter length
- Returns
averaged data of magnitude data Block
- Rtype mag_avg
np.ndarray
- pycsamt.utils.zcalculator.param_phz(pphz_array, to_degree=False)[source]
PHZn are from each data block , units in mrad
- Parameters
pphz_array (array_like) – average parameters phase for data blocs.
to_degree (bool) – ascertain convertion to degree
- pycsamt.utils.zcalculator.param_rho(rho_array)[source]
Parameter Average RHO (RHOp), RHO are from each data block, unit ( ohm.m)
- Parameters
rho_array (array_like) – array of resistivity values
- pycsamt.utils.zcalculator.perforce_reference_freq(dataset, frequency_array=None)[source]
Function to get automatically the reference frequency. If user does not provide the value, the function will find automatically value .
- Parameters
data (array_like) – array of avg DATA, ndim>1
frequency_array (array_like) – array of frequency
- Returns
reffreq_value float , reference frequency value
- Return type
float
- Returns
uncover_index, index of reference value on frequency array
- Return type
int
- Returns
nan_ratio , the ratio or the prevalence of nan in the data_set
- Return type
float
- pycsamt.utils.zcalculator.phz_avg(phz_array, to_degree)[source]
E-, H-field, or Impedance Phase values unit in mrad
- Parameters
phz_array (array_like) – array of phase values in mrad
to_degree (bool) – ascertain convertion to degree
- pycsamt.utils.zcalculator.plot_reference_frequency(reference_array, frequency_array, data_array, station_names=None, **kwargs)[source]
Function to plot reference frequency
- Parameters
reference_array (array_like,) – array_of average_impedance Z_avg.
frequency_array (array_like) – array of frequency on sites
data_array (ndarray,) – nadarray of sounding curve, ndarray(len(frequency), len(number_ofstaions).
- Return type
viewer
- pycsamt.utils.zcalculator.relocate_on_dict_arrays(data_array, number_of_frequency, station_names=None)[source]
Put data arrays on dictionnary where keys is each station and value the array of that station. if station_names is None , program will create name of station. if station_names is given , function will sorted stations names . please make sure to provide correctly station according the disposal you want .
- Parameters
number_of_frequency (array_like) – array of frequency during survey
station_names (list of array_like) – list of station
- Returns
infos at data stations
- Return type
dict
- pycsamt.utils.zcalculator.rhophi2z(phase, freq, resistivity=None, z_array=None)[source]
Function to compute z , real part and imag part .
- Parameters
phase (ndarray) – phase angles array in radians
freq (array_like) – frequencies array in Hz
resistivity (array_like) – rho array in ohm.m
z_array (array_like) – impedance z array in V/m
- Returns
z_abs , absolute value of zz
- Return type
float
- Returns
z_real, real part of complex number
- Return type
float
- Returns
z_imag, imaginary part of zz
- Return type
complex
- Returns
ndarray
- Return type
zz, array of z_abs, z_imag, z_real
- pycsamt.utils.zcalculator.truncated_data(data, number_of_reccurence, **kwargs)[source]
Function to truncate all data according to number of frequency.
- Parameters
data (*) – data must be truncate.
number_of_freq (*) – number of frequency imaged.
- Returns
loc_list , data truncated on list.
- Return type
list
- pycsamt.utils.zcalculator.wbetaX2(Xpos, dipole_length=50.0, number_of_points=5)[source]
weight Beta is computed following the paper of Torres-verdfn, C., and F. X. Bostick, 1992, Principles of spatial surface electric field filtering in magnetotellurics - Electromagnetic array profiling ( EMAP )- Geophysics, 57(4), 25–34.
- Parameters
Xpos (str) – reference position on the field
dipole_length (float) – length of dipole measurement
number_of_points (int) – point to stand filters , window width
- pycsamt.utils.zcalculator.weight_beta(dipole_length=50.0, number_of_points=7, window_width=None)[source]
WeightBeta function is weight Hanning window . if window width is not provide , function will compute the width of window.
See also
Torres-Verdin and Bostick, 1992, Principles of spatial surface electric field filtering in magnetotellurics: electromagnetic array profiling (EMAP), Geophysics, v57, p603-622. …
- Parameters
dipole_length (float) – length of dipole in meter (m)
number_of_points (int) – number of station points to filter
window_width (float) – the width of window filter
- Returns
beta_array at each station
- Return type
array_like
- pycsamt.utils.zcalculator.z_error2r_phi_error(z_real, z_imag, error)[source]
Error estimation from rectangular to polar coordinates. By standard error propagation, relative error in resistivity is 2*relative error in z amplitude. Uncertainty in phase (in degrees) is computed by defining a circle around the z vector in the complex plane. The uncertainty is the absolute angle between the vector to (x,y) and the vector between the origin and the tangent to the circle.
- Parameters
z_real (float) – real component of z (real number or array)
z_imag (complex) – imaginary component of z (real number or array)
error (float) – absolute error in z (real number or array)
- Returns
containers of relative error in resistivity, absolute error in phase
- Rtupe
tuple