# Path: pysmo/aimbat/ttconfig.py
# def getDefaults():
#     def __init__(self):
#     def __init__(self):
# def _load_xcorr_func(func):
#     def __init__(self):
#     def __init__(self):
# def getParser():
# class PPConfig:
# class QCConfig:
# class CCConfig:
# class MCConfig:
# 
# Path: pysmo/aimbat/qualsort.py
# def initQual(saclist, hdrsel, qheaders):
# def sortQual(saclist, qheaders, qweights, increase=True):
# def seleSeis(saclist):
# def sortSeisQual(saclist, qheaders, qweights, qfactors, increase=True):
# def sortSeisHeaderDiff(saclist, hdr0, hdr1, increase=True):
# def hdrtype(sacdh, hdr):
# def sortSeisHeader(saclist, hdr, increase=True):
# def getOptions():
# 
# Path: pysmo/aimbat/sacpickle.py
# def zipFile(zipmode='gz'):
# def fileZipMode(ifilename):
# def writePickle(d, picklefile, zipmode=None):
# def readPickle(picklefile, zipmode=None):
#     def __init__(self, ifile, delta=-1):
#     def resampleData(self, delta):
#     def gethdr(self, hdr):
#     def sethdr(self, hdr, val):
#     def writeHdrs(self):
#     def sethdrs(self, sacobj):
#     def savesac(self):
#     def __init__(self, ifiles, delta=-1):
#     def resampleData(self, delta):
# def resampleSeis(data, deltaold, delta):
# def sac2obj(ifiles, delta=-1):
# def sac2pkl(ifiles, pkfile='sac.pkl', delta=-1, zipmode='gz'):
# def obj2sac(gsac):
# def pkl2sac(pkfile, zipmode):
# def _days(year):
# def date2jul(year, mon, day):
# def jul2date(year, jday):
# def taper(data, taperwidth=0.1, tapertype='hanning'):
# def taperWindow(timewindow, taperwidth=0.1):
# def windowIndex(saclist, reftimes, timewindow=(-5.0,5.0), taperwindow=1.0):
# def windowData(saclist, nstart, ntotal, taperwidth, tapertype='hanning', datatype='data'):
# def windowTime(saclist, nstart, ntotal, taperwidth, tapertype='hanning'):
# def windowTimeData(saclist, nstart, ntotal, taperwidth, tapertype='hanning'):
# def loadData(ifiles, opts, para):
# def saveData(gsac, opts):
# def getOptions():
# def main():
# class SacDataHdrs:
# class SacGroup:
#     class BreakIt(Exception): pass
# 
# Path: pysmo/aimbat/prepdata.py
# def findPhase(filename):
#     """ Find phase (P or S) from component info (BH?) in file name 
#     """
#     lowf = filename.lower()
#     ind = lowf.find('bh')
#     zt = lowf[ind+2]
#     if zt == 'z':
#         phase = 'P'
#     elif zt == 't':
#         phase = 'S'
#     else:
#         print('Fail to identify phase. Exit.')
#         sys.exit()
#     return phase


import os
import sys
from time import strftime, tzname
from optparse import OptionParser
from numpy import array, mean, dot, zeros, log, transpose, concatenate, exp, sum, std, shape, sqrt, argsort, identity
from pysmo.aimbat import ttconfig
from pysmo.aimbat import qualsort
from pysmo.aimbat import sacpickle as sacpkl
from pysmo.aimbat.prepdata import findPhase
    from scipy.lib.lapack.flapack import dposv
                mdict[key] = odict[key]
    # check if params are complete
    if 'phase' not in mdict:
        print('\n No phase name given - stop')
        sys.exit()
    if 'timewindow' not in mdict:
        if 'window' in mdict and 'inset' in mdict:
            win, ins = mdict['window'], mdict['inset']
            mcpara.timewindow = [-ins, win-ins]
            if 'taper' in mdict:
                mcpara.taperwindow = mdict['taper']
            else:
                mcpara.taperwindow = sacpkl.taperWindow(mcpara.timewindow, mcpara.taperwidth)
        else:
            print('No window and inset length give - stop')
            sys.exit()
    # get event info from either event.list or gsac
    if not os.path.isfile(mcpara.evlist):
        mcpara.evlist = gsac.event
    evline, mcname = eventListName(mcpara.evlist, mcpara.phase)
    mcpara.evline = evline
    mcpara.mcname = mcname
    mcpara.kevnm = gsac.kevnm
    if mcpara.ofilename != 'mc':
        mcpara.mcname = mcpara.ofilename
    gsac.mcname = mcpara.mcname

def main():
    opts, ifiles = getOptions()
    mcpara = ttconfig.MCConfig()

# Path: pysmo/aimbat/ttconfig.py
# def getDefaults():
#     def __init__(self):
#     def __init__(self):
# def _load_xcorr_func(func):
#     def __init__(self):
#     def __init__(self):
# def getParser():
# class PPConfig:
# class QCConfig:
# class CCConfig:
# class MCConfig:
# 
# Path: pysmo/aimbat/qualsort.py
# def initQual(saclist, hdrsel, qheaders):
# def sortQual(saclist, qheaders, qweights, increase=True):
# def seleSeis(saclist):
# def sortSeisQual(saclist, qheaders, qweights, qfactors, increase=True):
# def sortSeisHeaderDiff(saclist, hdr0, hdr1, increase=True):
# def hdrtype(sacdh, hdr):
# def sortSeisHeader(saclist, hdr, increase=True):
# def getOptions():
# 
# Path: pysmo/aimbat/sacpickle.py
# def zipFile(zipmode='gz'):
# def fileZipMode(ifilename):
# def writePickle(d, picklefile, zipmode=None):
# def readPickle(picklefile, zipmode=None):
#     def __init__(self, ifile, delta=-1):
#     def resampleData(self, delta):
#     def gethdr(self, hdr):
#     def sethdr(self, hdr, val):
#     def writeHdrs(self):
#     def sethdrs(self, sacobj):
#     def savesac(self):
#     def __init__(self, ifiles, delta=-1):
#     def resampleData(self, delta):
# def resampleSeis(data, deltaold, delta):
# def sac2obj(ifiles, delta=-1):
# def sac2pkl(ifiles, pkfile='sac.pkl', delta=-1, zipmode='gz'):
# def obj2sac(gsac):
# def pkl2sac(pkfile, zipmode):
# def _days(year):
# def date2jul(year, mon, day):
# def jul2date(year, jday):
# def taper(data, taperwidth=0.1, tapertype='hanning'):
# def taperWindow(timewindow, taperwidth=0.1):
# def windowIndex(saclist, reftimes, timewindow=(-5.0,5.0), taperwindow=1.0):
# def windowData(saclist, nstart, ntotal, taperwidth, tapertype='hanning', datatype='data'):
# def windowTime(saclist, nstart, ntotal, taperwidth, tapertype='hanning'):
# def windowTimeData(saclist, nstart, ntotal, taperwidth, tapertype='hanning'):
# def loadData(ifiles, opts, para):
# def saveData(gsac, opts):
# def getOptions():
# def main():
# class SacDataHdrs:
# class SacGroup:
#     class BreakIt(Exception): pass
# 
# Path: pysmo/aimbat/prepdata.py
# def findPhase(filename):
#     """ Find phase (P or S) from component info (BH?) in file name 
#     """
#     lowf = filename.lower()
#     ind = lowf.find('bh')
#     zt = lowf[ind+2]
#     if zt == 'z':
#         phase = 'P'
#     elif zt == 't':
#         phase = 'S'
#     else:
#         print('Fail to identify phase. Exit.')
#         sys.exit()
#     return phase


# Path: pysmo/aimbat/algmccc.py
import os
import sys
from time import strftime, tzname
from optparse import OptionParser
from numpy import array, mean, dot, zeros, log, transpose, concatenate, exp, sum, std, shape, sqrt, argsort, identity
from pysmo.aimbat import ttconfig
from pysmo.aimbat import qualsort
from pysmo.aimbat import sacpickle as sacpkl
from pysmo.aimbat.prepdata import findPhase
    from scipy.lib.lapack.flapack import dposv

                mdict[key] = odict[key]
    # check if params are complete
    if 'phase' not in mdict:
        print('\n No phase name given - stop')
        sys.exit()
    if 'timewindow' not in mdict:
        if 'window' in mdict and 'inset' in mdict:
            win, ins = mdict['window'], mdict['inset']
            mcpara.timewindow = [-ins, win-ins]
            if 'taper' in mdict:
                mcpara.taperwindow = mdict['taper']
            else:
                mcpara.taperwindow = sacpkl.taperWindow(mcpara.timewindow, mcpara.taperwidth)
        else:
            print('No window and inset length give - stop')
            sys.exit()
    # get event info from either event.list or gsac
    if not os.path.isfile(mcpara.evlist):
        mcpara.evlist = gsac.event
    evline, mcname = eventListName(mcpara.evlist, mcpara.phase)
    mcpara.evline = evline
    mcpara.mcname = mcname
    mcpara.kevnm = gsac.kevnm
    if mcpara.ofilename != 'mc':
        mcpara.mcname = mcpara.ofilename
    gsac.mcname = mcpara.mcname

def main():
    opts, ifiles = getOptions()
    mcpara = ttconfig.MCConfig()

    gsac = sacpkl.loadData(ifiles, opts, mcpara)