Пример #1
0
    def __init__(
            self,
            approx_ticks=7.0,
            mode='auto',
            exp=None,
            snap=False,
            inc=None,
            space=0.0,
            exp_factor=3,
            no_exp_interval=(-3, 5)):

        '''
        Create new AutoScaler instance.

        The parameters are described in the AutoScaler documentation.
        '''

        Object.__init__(
            self,
            approx_ticks=approx_ticks,
            mode=mode,
            exp=exp,
            snap=snap,
            inc=inc,
            space=space,
            exp_factor=exp_factor,
            no_exp_interval=no_exp_interval)
Пример #2
0
    def __init__(self,
                 network='',
                 station='',
                 location='',
                 lat=0.0,
                 lon=0.0,
                 elevation=0.0,
                 depth=0.0,
                 name='',
                 channels=None):

        Object.__init__(self,
                        network=network,
                        station=station,
                        location=location,
                        lat=float(lat),
                        lon=float(lon),
                        elevation=elevation and float(elevation) or 0.0,
                        depth=depth and float(depth) or 0.0,
                        name=name or '',
                        channels=channels or [])

        self.dist_deg = None
        self.dist_m = None
        self.azimuth = None
        self.backazimuth = None
Пример #3
0
    def __init__(self, m=None, m_up_south_east=None, strike=0., dip=0., rake=0., scalar_moment=1.,
                 mnn=None, mee=None, mdd=None, mne=None, mnd=None, med=None,
                 strike1=None, dip1=None, rake1=None, strike2=None, dip2=None, rake2=None, magnitude=None, moment=None):

        Object.__init__(self, init_props=False)

        if any(mxx is not None for mxx in (mnn, mee, mdd, mne, mnd, med)):
            m = symmat6(mnn, mee, mdd, mne, mnd, med)
        
        strike = d2r*strike
        dip = d2r*dip
        rake = d2r*rake
        
        if m_up_south_east is not None:
            m = self._to_up_south_east * m_up_south_east * self._to_up_south_east.T
            
        if m is None:
            if any(x is not None for x in (strike1, dip1, rake1, strike2, dip2, rake2)):
                raise Exception('strike1, dip1, rake1, strike2, dip2, rake2 are read-only properties')

            if moment is not None:
                scalar_moment = moment

            if magnitude is not None:
                scalar_moment = magnitude_to_moment(magnitude)

            rotmat1 = euler_to_matrix( dip, strike, -rake )
            m = rotmat1.T * MomentTensor._m_unrot * rotmat1 * scalar_moment

        self._m = m
        self._update()
Пример #4
0
    def __init__(
            self,
            approx_ticks=7.0,
            mode='auto',
            exp=None,
            snap=False,
            inc=None,
            space=0.0,
            exp_factor=3,
            no_exp_interval=(-3, 5)):

        '''
        Create new AutoScaler instance.

        The parameters are described in the AutoScaler documentation.
        '''

        Object.__init__(
            self,
            approx_ticks=approx_ticks,
            mode=mode,
            exp=exp,
            snap=snap,
            inc=inc,
            space=space,
            exp_factor=exp_factor,
            no_exp_interval=no_exp_interval)
Пример #5
0
    def __init__(self,
                 m=None,
                 m_up_south_east=None,
                 strike=0.,
                 dip=0.,
                 rake=0.,
                 scalar_moment=1.,
                 mnn=None,
                 mee=None,
                 mdd=None,
                 mne=None,
                 mnd=None,
                 med=None,
                 strike1=None,
                 dip1=None,
                 rake1=None,
                 strike2=None,
                 dip2=None,
                 rake2=None,
                 magnitude=None,
                 moment=None):
        '''Create moment tensor object based on 3x3 moment tensor matrix or orientation of 
           fault plane and scalar moment.
           
        In:
           m -- Matrix in north-east-down convention
           m_up_south_east -- Matrix in up-south-east convention
           strike, dip, rake -- Fault plane angles in [degrees]
           scalar_moment -- Scalar moment in [Nm]
        '''
        Object.__init__(self, init_props=False)

        if any(mxx is not None for mxx in (mnn, mee, mdd, mne, mnd, med)):
            m = symmat6(mnn, mee, mdd, mne, mnd, med)

        strike = d2r * strike
        dip = d2r * dip
        rake = d2r * rake

        if m_up_south_east is not None:
            m = self._to_up_south_east * m_up_south_east * self._to_up_south_east.T

        if m is None:
            if any(x is not None
                   for x in (strike1, dip1, rake1, strike2, dip2, rake2)):
                raise Exception(
                    'strike1, dip1, rake1, strike2, dip2, rake2 are read-only properties'
                )

            if moment is not None:
                scalar_moment = moment

            if magnitude is not None:
                scalar_moment = magnitude_to_moment(magnitude)

            rotmat1 = euler_to_matrix(dip, strike, -rake)
            m = rotmat1.T * MomentTensor._m_unrot * rotmat1 * scalar_moment

        self._m = m
        self._update()
Пример #6
0
 def __init__(self, xmin, ymin, dx, dy, data):
     Object.__init__(self, init_props=False)
     self.xmin = float(xmin)
     self.ymin = float(ymin)
     self.dx = float(dx)
     self.dy = float(dy)
     self.data = data
     self._set_maxes()
Пример #7
0
 def __init__(self, **kwargs):
     self._do_auto_updates = False
     Object.__init__(self, **kwargs)
     self._index_function = None
     self._indices_function = None
     self._vicinity_function = None
     self._do_auto_updates = True
     self.update()
Пример #8
0
 def __init__(self, xmin, ymin, dx, dy, data):
     Object.__init__(self, init_props=False)
     self.xmin = float(xmin)
     self.ymin = float(ymin)
     self.dx = float(dx)
     self.dy = float(dy)
     self.data = data
     self._set_maxes()
Пример #9
0
    def __setattr__(self, name, value):
        Object.__setattr__(self, name, value)
        try:
            self.T.get_property(name)
            if self._do_auto_updates:
                self.update()

        except ValueError:
            pass
Пример #10
0
    def __init__(self, *args, **kwargs):
        if len(args) >= 1:
            kwargs['name'] = args[0]
        if len(args) >= 2:
            kwargs['unit'] = newstr(args[1])

        self.groups = [None]
        self._name = None

        Object.__init__(self, **kwargs)
Пример #11
0
    def __init__(self, *args, **kwargs):
        self.old_import = False

        mapping = {'orbit_direction': 'orbital_node'}

        for old, new in mapping.items():
            if old in kwargs.keys():
                kwargs[new] = kwargs.pop(old, None)
                self.old_import = True

        Object.__init__(self, *args, **kwargs)
Пример #12
0
    def __init__(self, *args, **kwargs):
        self.old_import = False
        mapping = {'dE': 'dLon', 'dN': 'dLat'}

        for new, old in mapping.items():
            if old in kwargs:
                kwargs[new] = kwargs.pop(old)
                kwargs['spacing'] = 'degree'
                self.old_import = True

        Object.__init__(self, *args, **kwargs)
Пример #13
0
    def __init__(self, name, azimuth=None, dip=None, gain=1.0):
        if azimuth is None:
            azimuth = guess_azimuth_from_name(name)
        if dip is None:
            dip = guess_dip_from_name(name)

        Object.__init__(self,
                        name=name,
                        azimuth=float_or_none(azimuth),
                        dip=float_or_none(dip),
                        gain=float(gain))
Пример #14
0
    def __init__(self, *args, **kwargs):
        self.old_import = False
        mapping = {"dE": "dLon", "dN": "dLat"}

        for new, old in mapping.items():
            if old in kwargs:
                kwargs[new] = kwargs.pop(old)
                kwargs["spacing"] = "degree"
                self.old_import = True

        Object.__init__(self, *args, **kwargs)
Пример #15
0
    def __init__(self,
                 m=None,
                 m_up_south_east=None,
                 strike=0.,
                 dip=0.,
                 rake=0.,
                 scalar_moment=1.,
                 mnn=None,
                 mee=None,
                 mdd=None,
                 mne=None,
                 mnd=None,
                 med=None,
                 strike1=None,
                 dip1=None,
                 rake1=None,
                 strike2=None,
                 dip2=None,
                 rake2=None,
                 magnitude=None,
                 moment=None):

        Object.__init__(self, init_props=False)

        if any(mxx is not None for mxx in (mnn, mee, mdd, mne, mnd, med)):
            m = symmat6(mnn, mee, mdd, mne, mnd, med)

        strike = d2r * strike
        dip = d2r * dip
        rake = d2r * rake

        if m_up_south_east is not None:
            m = self._to_up_south_east * m_up_south_east * \
                self._to_up_south_east.T

        if m is None:
            if any(x is not None
                   for x in (strike1, dip1, rake1, strike2, dip2, rake2)):
                raise Exception(
                    'strike1, dip1, rake1, strike2, dip2, rake2 are read-only '
                    'properties')

            if moment is not None:
                scalar_moment = moment

            if magnitude is not None:
                scalar_moment = magnitude_to_moment(magnitude)

            rotmat1 = euler_to_matrix(dip, strike, -rake)
            m = rotmat1.T * MomentTensor._m_unrot * rotmat1 * scalar_moment

        self._m = m
        self._update()
Пример #16
0
    def __init__(self, **kwargs):

        mode = 'mode'
        mode_config = 'mode_config'
        if mode in kwargs:
            omode = kwargs[mode]

            if omode == 'ffi':
                if mode_config not in kwargs:
                    kwargs[mode_config] = FFIConfig()

        Object.__init__(self, **kwargs)
Пример #17
0
    def __init__(self, **kwargs):
        Object.__init__(self, **kwargs)
        self.parameters = []

        self._ds = None
        self._result_mode = 'sparse'

        self._combined_weight = None
        self._target_parameters = None
        self._target_ranges = None

        self._combined_weight = None
Пример #18
0
    def __init__(self, name, azimuth=None, dip=None, gain=1.0):
        if azimuth is None:
            azimuth = guess_azimuth_from_name(name)
        if dip is None:
            dip = guess_dip_from_name(name)

        Object.__init__(
            self,
            name=name,
            azimuth=float_or_none(azimuth),
            dip=float_or_none(dip),
            gain=float(gain))
Пример #19
0
    def __init__(self, **kwargs):
        Object.__init__(self, **kwargs)

        if self.grond_version is None:
            self.grond_version = __version__

        self._target_weights = None
        self._engine = None
        self._family_mask = None

        if hasattr(self, 'problem_waveform_parameters') and self.has_waveforms:
            self.problem_parameters =\
                self.problem_parameters + self.problem_waveform_parameters
Пример #20
0
    def __init__(self, name, lat, lon, population=None, asciiname=None):
        name = unicode(name)
        lat = float(lat)
        lon = float(lon)
        if asciiname is None:
            asciiname = name.encode("ascii", errors="replace")

        if population is None:
            population = 0
        else:
            population = int(population)

        Object.__init__(self, name=name, lat=lat, lon=lon, population=population, asciiname=asciiname)
Пример #21
0
    def __init__(self, name, lat, lon, population=None, asciiname=None):
        name = newstr(name)
        lat = float(lat)
        lon = float(lon)
        if asciiname is None:
            asciiname = name.encode('ascii', errors='replace')

        if population is None:
            population = 0
        else:
            population = int(population)

        Object.__init__(self, name=name, lat=lat, lon=lon,
                        population=population, asciiname=asciiname)
Пример #22
0
    def __init__(self, name, lat, lon, population=None, asciiname=None):
        name = newstr(name)
        lat = float(lat)
        lon = float(lon)
        if asciiname is None:
            asciiname = name.encode('ascii', errors='replace')

        if population is None:
            population = 0
        else:
            population = int(population)

        Object.__init__(self, name=name, lat=lat, lon=lon,
                        population=population, asciiname=asciiname)
Пример #23
0
    def __init__(self, network='', station='', location='', lat=0.0, lon=0.0,
                 elevation=0.0, depth=0.0, name='', channels=None):

        Object.__init__(self,
            network=network, station=station, location=location,
            lat=float(lat), lon=float(lon),
            elevation=elevation and float(elevation) or 0.0,
            depth=depth and float(depth) or 0.0,
            name=name or '',
            channels=channels or [])

        self.dist_deg = None
        self.dist_m = None
        self.azimuth = None
        self.backazimuth = None
Пример #24
0
 def __init__(self, **kwargs):
     Object.__init__(self, **kwargs)
     self._gmt = None
     self._scaler = None
     self._widget = None
     self._corners = None
     self._wesn = None
     self._minarea = None
     self._coastline_resolution = None
     self._rivers = None
     self._dems = None
     self._have_topo_land = None
     self._have_topo_ocean = None
     self._jxyr = None
     self._prep_topo_have = None
     self._labels = []
Пример #25
0
 def __init__(self, **kwargs):
     Object.__init__(self, **kwargs)
     self._gmt = None
     self._scaler = None
     self._widget = None
     self._corners = None
     self._wesn = None
     self._minarea = None
     self._coastline_resolution = None
     self._rivers = None
     self._dems = None
     self._have_topo_land = None
     self._have_topo_ocean = None
     self._jxyr = None
     self._prep_topo_have = None
     self._labels = []
Пример #26
0
    def __init__(self, *args, **kwargs):
        Object.__init__(self, *args, **kwargs)

        self.h = num.abs(self.d - num.roll(self.d, -1))
        self.h[-1] = 0
        self.nlayers = self.h.size

        self.geographical_location = '%s (%s)' % (provinceKey(
            self.geographical_location), self.geographical_location)

        self.vs[self.vs == 0] = num.nan
        self.vp[self.vp == 0] = num.nan

        self._step_vp = num.repeat(self.vp, 2)
        self._step_vs = num.repeat(self.vs, 2)
        self._step_d = num.roll(num.repeat(self.d, 2), -1)
        self._step_d[-1] = self._step_d[-2] + THICKNESS_HALFSPACE
Пример #27
0
    def __init__(self, *args, **kwargs):
        kwargs.update(self.args2kwargs(args))
        sources = kwargs.pop('sources', [])
        targets = kwargs.pop('targets', [])
        reductions = kwargs.pop('reductions', [])

        if isinstance(sources, Source):
            sources = [sources]

        if isinstance(targets, Target):
            targets = [targets]

        if isinstance(reductions, Reduction):
            reductions = [reductions]

        Object.__init__(self, sources=sources, targets=targets,
                        reductions=reductions, **kwargs)
Пример #28
0
    def __init__(self, *args, **kwargs):
        Object.__init__(self, *args, **kwargs)

        self.h = num.abs(self.d - num.roll(self.d, -1))
        self.h[-1] = 0
        self.nlayers = self.h.size

        self.geographical_location = '%s (%s)' % (
            provinceKey(self.geographical_location),
            self.geographical_location)

        self.vs[self.vs == 0] = num.nan
        self.vp[self.vp == 0] = num.nan

        self._step_vp = num.repeat(self.vp, 2)
        self._step_vs = num.repeat(self.vs, 2)
        self._step_d = num.roll(num.repeat(self.d, 2), -1)
        self._step_d[-1] = self._step_d[-2] + THICKNESS_HALFSPACE
Пример #29
0
    def __init__(self, lat=0., lon=0., time=0., name='', depth=None,
            magnitude=None, magnitude_type=None, region=None, load=None,
            loadf=None, catalog=None, moment_tensor=None, duration=None):

        vals = None
        if load is not None:
            vals = Event.oldload(load)
        elif loadf is not None:
            vals = Event.oldloadf(loadf)

        if vals:
            lat, lon, time, name, depth, magnitude, magnitude_type, region, \
                catalog, moment_tensor, duration = vals
            
        Object.__init__(self, lat=lat, lon=lon, time=time, name=name, depth=depth,
                        magnitude=magnitude, magnitude_type=magnitude_type,
                        region=region, catalog=catalog,
                        moment_tensor=moment_tensor, duration=duration)
Пример #30
0
    def __init__(self, m=None, m_up_south_east=None, strike=0., dip=0., rake=0., scalar_moment=1.,
                 mnn=None, mee=None, mdd=None, mne=None, mnd=None, med=None,
                 strike1=None, dip1=None, rake1=None, strike2=None, dip2=None, rake2=None, magnitude=None, moment=None):

        '''Create moment tensor object based on 3x3 moment tensor matrix or orientation of 
           fault plane and scalar moment.
           
        In:
           m -- Matrix in north-east-down convention
           m_up_south_east -- Matrix in up-south-east convention
           strike, dip, rake -- Fault plane angles in [degrees]
           scalar_moment -- Scalar moment in [Nm]
        ''' 
        Object.__init__(self, init_props=False)

        if any(mxx is not None for mxx in (mnn, mee, mdd, mne, mnd, med)):
            m = symmat6(mnn, mee, mdd, mne, mnd, med)
        
        strike = d2r*strike
        dip = d2r*dip
        rake = d2r*rake
        
        if m_up_south_east is not None:
            m = self._to_up_south_east * m_up_south_east * self._to_up_south_east.T
            
        if m is None:
            if any(x is not None for x in (strike1, dip1, rake1, strike2, dip2, rake2)):
                raise Exception('strike1, dip1, rake1, strike2, dip2, rake2 are read-only properties')

            if moment is not None:
                scalar_moment = moment

            if magnitude is not None:
                scalar_moment = magnitude_to_moment(magnitude)

            rotmat1 = euler_to_matrix( dip, strike, -rake )
            m = rotmat1.T * MomentTensor._m_unrot * rotmat1 * scalar_moment

        self._m = m
        self._update()
Пример #31
0
    def __init__(self, **kwargs):
        Object.__init__(self, **kwargs)

        if self.grond_version is None:
            self.grond_version = __version__

        self._target_weights = None
        self._engine = None
        self._family_mask = None

        if hasattr(self, 'problem_waveform_parameters') and self.has_waveforms:
            self.problem_parameters =\
                self.problem_parameters + self.problem_waveform_parameters

        unused_parameters = []
        for p in self.problem_parameters:
            if p.optional and p._name not in self.ranges.keys():
                unused_parameters.append(p)

        for p in unused_parameters:
            self.problem_parameters.remove(p)

        self.check()
Пример #32
0
    def __init__(self,
                 lat=0.,
                 lon=0.,
                 time=0.,
                 name='',
                 depth=None,
                 magnitude=None,
                 magnitude_type=None,
                 region=None,
                 load=None,
                 loadf=None,
                 catalog=None,
                 moment_tensor=None,
                 duration=None):

        vals = None
        if load is not None:
            vals = Event.oldload(load)
        elif loadf is not None:
            vals = Event.oldloadf(loadf)

        if vals:
            lat, lon, time, name, depth, magnitude, magnitude_type, region, \
                catalog, moment_tensor, duration = vals

        Object.__init__(self,
                        lat=lat,
                        lon=lon,
                        time=time,
                        name=name,
                        depth=depth,
                        magnitude=magnitude,
                        magnitude_type=magnitude_type,
                        region=region,
                        catalog=catalog,
                        moment_tensor=moment_tensor,
                        duration=duration)
Пример #33
0
 def __init__(self, **kwargs):
     Object.__init__(self, **kwargs)
     self._path = None
     self._pile = None
     self._engine = None
     self._scenes = None
Пример #34
0
 def __init__(self, **kwargs):
     Object.__init__(self, **kwargs)
     self._path = None
     self._pile = None
     self._engine = None
     self._scenes = None
Пример #35
0
 def __init__(self, **kwargs):
     last[0] = len(kwargs)
     Object.__init__(self, **kwargs)
Пример #36
0
 def dump(self, *args, **kwargs):
     self.regularize()
     return Object.dump(self, *args, **kwargs)
Пример #37
0
 def __init__(self, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self._cov_mat = None
     self._cor_mat = None
Пример #38
0
 def __init__(self, **kwargs):
     Object.__init__(self, **kwargs)
     self._seed = None
     self._parent = None
     self.update_hierarchy()
     self._retry_offset = 0
Пример #39
0
 def __init__(self, name=None, **kwargs):
     Object.__init__(self, name=name, **kwargs)
Пример #40
0
    def __init__(self, piggy_id=None, **kwargs):
        if piggy_id is None:
            piggy_id = self.new_piggy_id()

        Object.__init__(self, piggy_id=piggy_id, **kwargs)
Пример #41
0
 def __init__(self, name=None, **kwargs):
     Object.__init__(self, name=name, **kwargs)
Пример #42
0
 def dump(self, *args, **kwargs):
     self.regularize()
     return Object.dump(self, *args, **kwargs)
Пример #43
0
 def __init__(self, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self._basepath = None
     self._parent_path_prefix = None
Пример #44
0
 def __init__(self, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self._cov_mat = None
     self._cor_mat = None
Пример #45
0
    def __setattr__(self, name, value):
        if name in ('lat', 'lon', 'north_shift', 'east_shift'):
            self.__dict__['_latlon'] = None

        Object.__setattr__(self, name, value)
Пример #46
0
 def __init__(self, **kwargs):
     Object.__init__(self, **kwargs)
     self._latlon = None
Пример #47
0
 def __init__(self, scene, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self.scene = scene
     self.evProcessChanged = Subject()
Пример #48
0
 def __init__(self, value=None, **kwargs):
     Object.__init__(self, value=value, **kwargs)
Пример #49
0
 def __init__(self, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self._rstate = None
Пример #50
0
 def __init__(self, *args, **kwargs):
     kwargs.update(zip(self.T.propnames, args))
     Object.__init__(self, **kwargs)
Пример #51
0
 def __init__(self, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self._cached_result = None
     self.evParametersChanged = Subject()
Пример #52
0
 def __init__(self, value=None, **kwargs):
     Object.__init__(self, value=value, **kwargs)
Пример #53
0
 def __init__(self, *args, **kwargs):
     Object.__init__(self, *args, **kwargs)
     self._mask_water = None
Пример #54
0
 def __setattr__(self, attr, value):
     if attr in self.T.propnames:
         self.evProcessChanged.notify()
     Object.__setattr__(self, attr, value)
    def __init__(self, **kwargs):

        # call the guts initilizer
        Object.__init__(self, **kwargs)