BIRRPTools: an interface to BIRRP

Module of tool that can be applied to BIRRP outputs

Created on %(date)s

@author: %(Jared Peacock)s

MTpy.core.BIRRPTools.bbcalfunc(bbfile, nfreqlst)[source]

bbcalfunc(bbfile,nfreqlst) will generate a function fitting the calibration data in bbfile to the frequencies in nfreqlst using a cubic interpolation algorithm. The output is the real and imaginary functions as a function of the nfreqlst in units of microV/nT.

MTpy.core.BIRRPTools.bbconvz(z, freq, bbfile, dlgain)[source]

bbconvz(dirpath,bbfile,dlgain)will convert the .rf output files of BIRRP into correct units using broadband calibrations given by file bbcalfile that has format log(freq),breal,bimag. dlgain is the data logger gain (verylow= 2.5,low=1,high=.1) The output is period,freq,z[[zijr,ziji,zije]]. Note that it assumes the efields are already converted.

MTpy.core.BIRRPTools.callBIRRP(scriptfile, birrploc)[source]

callBIRRP(scriptfile,birrploc) will call BIRRP from a command window and run the script file provided.

Inputs:

scriptfile = full path script file birrploc = path to BIRRP on your computer, can be the full path to a

BIRRP executable C:BIRRPirrp5.exe
Outputs:
bfpath = path to BIRRP output files
MTpy.core.BIRRPTools.convertBIRRPoutputs(bfpath, stationinfofile, station, rrstation=None, bbfile=None, birrpdict=None, ffactor=1, edipath=None)[source]

convertBIRRPoutputs(bfpath,stationinfodict) will take the outputs of BIRRP and manipulate them into .edi, .dat, .coh, .imp files as well as generate plots of apparent resistivity and phase and coherence.

Inputs:

bfpath = path to BIRRP output files stationinfodict = dictionary containing pertanent information with keys:

station = station to process rrstation = remote reference station name bbfile = broad band calibration file path birrpdict = dictionary of birrp parameters used ffactor = scaling factor for apparent resistivities and phase edipath = path to save edifile to

Outputs:
cohfile datfile edifile impfile
MTpy.core.BIRRPTools.finishBeep()[source]
MTpy.core.BIRRPTools.lpconvz(z, dlgain=1)[source]

Convert the magnetic field from counts to units of microV/nT. bfield is a list of numbers. dlain is amount of gain applied by data logger(verylow=2.5,low=1, high=.1)

Inputs:
bfield = 1D array of long period data dlgain = data logger gain (very low= 2.5,low = 1, high = .1)
Outputs:
bfieldc = scaled bfield 1D array
MTpy.core.BIRRPTools.plotBFfiles(edifile, cohfile=None, cfilelst=None, save='y', ffactor=1, show='n', sdict=None)[source]

plotFiles(edifile,cohfile,cfilelst) will plot the apparent resisitivty and phase calculated from edifile as 2 seperate plots for the different polarizations. It will plot the coherency between components and if input will plot the time series.

Input:
edifile = full path to edifile cohfile = full path to coherence file cfilelst = list of paths to combined files saveyn= ‘y’ to save plots, ‘n’ to not save plots seeyn = ‘y’ if you want to see the plots, ‘n’ if you just want to save

Outputs:

MTpy.core.BIRRPTools.read2c2(filename)[source]

read2c2(filename) will read in a .2c2 file output from BIRRP and return a list containing [period],[freq],[coh],[zcoh]. Note if any of the coherences are negative a value of 0 will be given to them.

MTpy.core.BIRRPTools.readProDict(processinginfofile, dirpath, filtered=None, rrfiltered=None, kwargs=None)[source]

readProDict will read in the information from processing infofile and output as a list of dictionaries. Inputs:

processinginfofile=tab delimited text file with appropriate information. dirpath = directory path to where station folders are
Outputs:
plst = list of dictionaries with key words related to headers of txt
file
MTpy.core.BIRRPTools.readcoh(filename)[source]

readcoh(filename) will read a coherence file writen by writecoh. The output is period,frequency,coh1,zcoh1,coh2,zcoh2,coh3,zcoh3

MTpy.core.BIRRPTools.readdat(filename)[source]

readdat(filename) will read in a .dat file written by writedat and output ofil, period,[resistivity,resistivityerr],[phase,phaseerr]

MTpy.core.BIRRPTools.readimp(filename)[source]

readimp(filename) will read in the impedances from a .imp file written by writeimp. the output is ofil,period,z[zr,zi]

MTpy.core.BIRRPTools.readini(inifilename)[source]

readini(inifilename) will read in an inifile and return a dictionary of initial parameters for the burpinterface program.

MTpy.core.BIRRPTools.readj(jfn, egain=1, dlgain=1, dlen=[50, 50], magtype='bb', bbfile='c:\\Peacock\\PHD\\BIRRP\\bbconv.txt', ffactor=1)[source]

readj will read in the .j file output by BIRRP, which is better than reading in the .irj.rf files.

MTpy.core.BIRRPTools.readrf(dirpath, egain=1, dlgain=1, dlen=[1, 1], magtype='bb', bbfile='c:\\Peacock\\PHD\\BIRRP\\bbconv.txt', ffactor=1)[source]

readrf(dirpath) will read in .irj.rf file output by BIRRP that reside in the folder nominated by dirpath. Returns: period, freq, z[ijreal,ijimag,ijvar] as array. If any of the numbers are NaN or +Inf they are set to zero

MTpy.core.BIRRPTools.runBIRRPpp(dirpath, processingdict, stationinfofile, birrploc, ffactor=1, edipath=None)[source]

runBIRRPpp will processes a station from start to finish on seperate processors

Inputs:

dirpath = full path to station folders processinginfodict = dictionary of processing info

stationinfofile = full path to station info file containing info about
survey parameters

birrploc = location of BIRRP and bbconv.csv ffactor = factor to scale apparent resistivities and phases edipath = common folder to copy edifiles

Outputs:
dictionary with keys:
cohfile datfile edifile impfile logfile scriptfile
MTpy.core.BIRRPTools.scriptfilePrep(prepdict)[source]
scriptfilePrep(prepdict) will calculate parameters, combine files and
convert if need be. Keys for prepdict are:

dirpath = dirpath to station folders -> d:Data cdirpath = full path to time series files if not entered will default to

dirpathstationday
cdirpathr = full path to remote reference time series if not entered
dirpath
rstationday

station = station name day = UTC day string of length 3 -> 035 rrstation = remote reference station name cacherate = length of data files string of hhmmss -> 1 hour data files

is 010000, 10 min is 001000

start = start time for combining files in hhmmss stop = stop time for combining files in hhmmss rrstart = start time of remote reference in hhmmss rrstop = stop time of remote reference in hhmmss dec = decimation factor (0 for no decimation, needs to be an integer) df = sampling frequency in Hz magori = orientation of magnetic components as N,E,Z -> for measured BX

to East input as [BY,BX,BZ] omit BZ if not measured
elecori = orientation of electric components as N,E -> for EX measured
to N input as [EX,EY]
rrmagori = orientation of remote reference magnetometers as N,E,Z omit
Z if not measured

filtered = ‘Filtered’ if filtered, don’t enter if not filtered rrfiltered = ‘Filtered’ if remote reference is filtered fdict = dictionary for adaptive notch filter see

MTtools.adaptiveNotchFilter() for details
returns procesing dictionary with keys:
cfilelst = list of files combined full path rrcfilelst = list of remote reference files combined full path station = station deltat = sampling rate (+) for time (-) for frequency nfft = max window length nsctmax = max number of windows nskipr = number of points to skip for remote reference
MTpy.core.BIRRPTools.sigfigs(numstr, digits=8, fmt='g')[source]

sigfigs(numstr,digits=8,fmt=’g’) will return a string with the proper amount of significant digits for the input number, can be str or float.

MTpy.core.BIRRPTools.sil(iniline)[source]

sil(iniline) will split a single line written in an .ini file for burpinterface and return the list of strings.

MTpy.core.BIRRPTools.writeLogfile(bfpath, station, cohfile, datfile, impfile, scriptfile)[source]

writeLogfile will write a log file of how a station was processed

MTpy.core.BIRRPTools.writeScriptfile(processingdict)[source]

writeScriptfile(processingdict will write a script file for BIRRP using info in processingdict which is a dictionary with keys:

cfilelst = list of combined filenames (full path) ordered as:
[electric N, electric E, mag N, mag E, mag Z] can omit Z if not measured
rrcfilelst = list of combined remote reference filenames (full
path) ordered as: [mag N, mag E, mag Z] omit z if not measured

station = station name magtype = bb for broadband lp for longperiod any BIRRP parameters you desire, (if not input default values will be assigned) namely:

ilev = processing mode 0 for basic and 1 for advanced RR-2 stage nout = Number of Output time series (2 or 3-> for BZ) ninp = Number of input time series for E-field (1,2,3) nref = Number of reference channels (2 for MT) nrr = bounded remote reference (0) or 2 stage bounded influence (1) tbw = Time bandwidth for Sepian sequence deltat = Sampling rate (+) for (s), (-) for (Hz) nfft = Length of FFT (should be even) nsctinc = section increment divisor (2 to divide by half) nsctmax = Number of windows used in FFT nf1 = 1st frequency to extract from FFT window (>=3) nfinc = frequency extraction increment nfsect = number of frequencies to extract mfft = AR filter factor, window divisor (2 for half) uin = Quantile factor determination ainlin = Residual rejection factor low end (usually 0) ainuin = Residual rejection factor high end (.95-.99) c2threshb = Coherence threshold for magnetics (0 if undesired) c2threshe = Coherence threshold for electrics (0 if undesired) nz= Threshold for Bz (0=separate from E, 1=E threshold, 2=E and B)

Input if 3 B components else None

c2thresh1= Squared coherence for Bz, input if NZ=0, Nout=3 perlo = longest period to apply coherence threshold over perhi = shortes period to apply coherence threshold over ofil = Output file root(usually three letters, can add full path) nlev = Output files (0=Z; 1=Z,qq; 2=Z,qq,w; 3=Z,qq,w,d) nprej = number of frequencies to reject prej = frequencies to reject (+) for period, (-) for frequency npcs = Number of independent data to be processed (1 for one

segement)

nar = Prewhitening Filter (3< >15) or 0 if not desired’, imode = Output file mode (0=ascii; 1=binary; 2=headerless ascii;

3=ascii in TS mode’,
jmode = nput file mode (0=user defined; 1=start time
YYYY-MM-DD HH:MM:SS)’,
nread = Number of points to be read for each data set
(if segments>1 -> npts1,npts2...)’,

nfil = Filter parameters (0=none; >0=input parameters; <0=filename nskip = Skip number of points in time series (0) if no skip,

(if segements >1 -> input1,input2...)’,
nskipr = Number of points to skip over (0) if none,
(if segements >1 -> input1,input2...)’,
thetae = Rotation angles for electrics (relative to geomagnetic
North)(N,E,rot)’,
thetab = Rotation angles for magnetics (relative to geomagnetic
North)(N,E,rot)’,
thetar = Rotation angles for calculation (relative to geomagnetic
North)(N,E,rot)’

=> see BIRRP Manual for more details on the parameters => see A. D. Chave and D. J. Thomson [1989,2003,2004] for more

information on Bounded influence and robust processing.
ouputs:
scriptfile (full path typically(dirpathstationdayCombSTtoETddecBF) birrpdict = dictionary of all birrp parameters in script file
MTpy.core.BIRRPTools.writecoh(dirpath, tsp=' ')[source]

writecoh(dirpath) will write a coherence file using the BIRRP outputs residing in the dirpath folder. The output file is tab delimited and if any values are negative they are put to 0. Each value has 7 significant digits. Returns written to filename.

MTpy.core.BIRRPTools.writedat(dirpath, egain=10, dlgain=1, dlen=[50, 50], magtype='bb', bbfile='c:\\Peacock\\PHD\\BIRRP\\bbconv.txt', tsp=' ', ffactor=1)[source]

writebbdat(dirpath,magtype,df,dlgain,bbfile=None) will write a .dat (resistivity and phase) file from .rf output files from birrp after converting the broadband magnetic channels. dirpath is where the .rf files reside, bb file is where the conversion file resides and df is the sampling frequency. Returns written to filename.

MTpy.core.BIRRPTools.writeedi(dirpath, station, stationinfofile=None, rrstation=None, birrpdict=None, bbfile='c:\\Peacock\\PHD\\BIRRP\\bbconv.txt', tsp=' ', ffactor=1)[source]

writeedi2(dirpath,stationinfofile,station,bbfile= r’c:PeacockPHDBIRRPbconv.txt’) will write an .edi file for a station processed by BIRRP given the station info file, station and bbfile if applicable. Returns the full path to the .edi file.

MTpy.core.BIRRPTools.writeimp(dirpath, egain=10, dlgain=1, dlen=[50, 50], magtype='bb', bbfile='c:\\Peacock\\PHD\\BIRRP\\bbconv.txt', tsp=' ', ffactor=1)[source]

writebbimp(dirpath,magtype,dlgain,bbfile=None)writes a tab delimited .imp file of converted impedances from.rf outputs of BIRRP and calibrates using file bbfile and dlgain which is the data logger gain (verylow=2.5,low=1,high=.1). Returns written to filename.

MTpy.core.BIRRPTools.writeini(filepath, argsdict)[source]

writeini(filepath,station,argsdict) will write an .ini file from the to the filepath as station.ini. The argsdict must be len 40 or will not write, the variables should be: dict[defdirpath,station,magtype,lpyn,eyn,mcomps,magdec, df,cacherate, dlength,dlgain,egain,lpbzcor,bbcal,magori,birrploc,ilev,nout, ninp,tbw,nfft,nsctmax,uin,ainuin,c2threshe,nz,c2threshe1,ofil, nlev,nar,imode,jmode,nfil,complstr,thetae,thetab,thetaf].

Previous topic

TFtools: times series analysis

Next topic

MTtools: tools for working with MT response functions

This Page