| |
- builtins.Exception(builtins.BaseException)
-
- TEvalEx
- TFEx
- builtins.object
-
- Event
- EventWrapper
- Model
- TimescapeEvaluator
- Voxel
class Event(builtins.object) |
|
Event(label: str = None, t: float = None, ct: float = None, x: float = None, y: float = None, val: float = None) -> None
a source event |
|
Methods defined here:
- __eq__(self, other)
- __init__(self, label: str = None, t: float = None, ct: float = None, x: float = None, y: float = None, val: float = None) -> None
- __repr__(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __annotations__ = {'ct': <class 'float'>, 'label': <class 'str'>, 't': <class 'float'>, 'val': <class 'float'>, 'x': <class 'float'>, 'y': <class 'float'>}
- __dataclass_fields__ = {'ct': Field(name='ct',type=<class 'float'>,default=Non...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'label': Field(name='label',type=<class 'str'>,default=No...rue,metadata=mappingproxy({}),_field_type=_FIELD), 't': Field(name='t',type=<class 'float'>,default=None...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'val': Field(name='val',type=<class 'float'>,default=No...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'x': Field(name='x',type=<class 'float'>,default=None...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'y': Field(name='y',type=<class 'float'>,default=None...rue,metadata=mappingproxy({}),_field_type=_FIELD)}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- ct = None
- label = None
- t = None
- val = None
- x = None
- y = None
|
class EventWrapper(builtins.object) |
|
EventWrapper(event, dist)
a source event with distance to target, ordered by distance |
|
Methods defined here:
- __eq__(self, other)
- __init__(self, event, dist)
- Initialize self. See help(type(self)) for accurate signature.
- __lt__(self, other)
- Return self<value.
- __repr__(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __dataclass_fields__ = {}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
|
class Model(builtins.object) |
|
The class of a Timescape model.
Attributes
----------
source: [Event], the source events
target: [[[Voxel]]], the target events (i.e. the bulk)
params: {}, the model parameters
ALGORITHM: str, default KRIG, the interpolator method, one of KRIG, IDW, SIDW or a user-defined method
NEIGH: int, default 0 (all), tne maximum number of neighborhoods
METRIC: str, default EUCLID, the spatial metric function, one of
EUCLID = 0, the Euclidean distance
DIAMOND = 1, the diamond metric d = x + y
SQUARE = 2, the square metric d = max{x, y}
SPHERE = -1, the geodesic arc length on the sphere
RADIUS: float, default Earth radus, the radius of the SPHERE metric
C: float, the Timescape c parameter
K: float, the Timescape k parameter
KPERIOD: float, optional, the causal cone period
NT: int, the number of bulk sheets
NX: int, the number of bulk rows
NY: int, the number of bulk columns
MINT, MAXT: float, the bulk time bounds
MINX, MAXX: float, the bulk x (rows) bounds
MINY, MAXY: float, the bulk y (columns) bounds
MYPAR_*: str, any user-defined parameter
straight: bool, the shape of the causal cone, straight / periodic
omega: float, default 0, the frequency of KPERIOD
null_vxl: int, number of null target events
bad_vxl: int, number of bad target events
Methods
----------
time(k:int): the time of the k sheet
place(i:int, j:int): the place of the (i, j) core
coordinates(k:int, i:int, j:int): the centroid of the target voxel of indices (k, i, j)
voxel(t:float, x:float, y:float): the voxel containing (t, x, y)
write_tsm(picklefile=FILEPATH_TSM): saves the model as a pickle binary file
write_txt(txtfile=FILEPATH_TXT): saves the model as a text file (csv and metadata)
write_tiff(tiffilespref=FILEPATH_TIF): saves the model as three tiff files (value, accuracy and neighborhood)
extract_bulk(self, field=FIELD_VAL): extracts the bulk as a numpy array
extract_sheet(self, k, field=FIELD_VAL): extracts a sheet as a numpy array
extract_core(self, i, j, field=FIELD_VAL): extracts a core as a numpy array
time_series(self, i, j, outfile=FILEPATH_TME): writes a time series on a text file
desc(self): prints a model description
show(self, field=FIELD_VAL): shows the bulk values, accuracies or neighborhood as volume isosurfaces
histogram(self, field=FIELD_VAL): plots the values, accuracy or neighborhood histogram
plot_bulk(self): plot_bulk(self): plots the bulk as a 3d scatterplot
plot_sheet(self, k): plot_sheet(self, k): plots a sheet as points and contour lines
plot_core(self, i, j): plot_core(self, i, j): plots a core as a time series |
|
Methods defined here:
- __eq__(self, other)
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- coordinates(self, k: int, i: int, j: int)
- Finds the centroid of the target voxel of indices (k, i, j)
Parameters
----------
k: int, sheet index
i: int, row index
j: int, column index
Raises
------
TFEx if out range
Yields
-------
t: float, time
x: float, x-coordinate
y: float, y-coordinate
- desc(self)
- calls describe_model(self)
- extract_bulk(self, field='VAL')
- calls extract_bulk(self, field)
- extract_core(self, i, j, field='VAL')
- calls extract_core(self, i, j, field)
- extract_sheet(self, k, field='VAL')
- calls extract_sheet(self, k, field)
- histogram(self, field='VAL')
- calls target_histogram(self, field)
- place(self, i: int, j: int)
- Finds the place of the (i, j) core
Parameters
----------
i: int, row index
j: int, column index
Raises
------
TFEx if out range
Yields
-------
x: float, x-coordinate
y: float, y-coordinate
- plot_bulk(self)
- calls plot_bulk(self, field)
- plot_core(self, i, j)
- calls plot_core(self, i, j, field)
- plot_sheet(self, k)
- calls plot_sheet(self, k, field)
- show(self, field='VAL')
- calls target_show(self, field)
- time(self, k: int)
- Finds the time of the k sheet
Parameters
----------
k: int, sheet index
Raises
------
TFEx if out range
Yields
-------
t: float, time
- time_series(self, i, j, outfile='./ts_time_series.txt')
- calls time_series(self, i, j, outfile)
- voxel(self, t: float, x: float, y: float)
- Returns voxel contaning the (t, x, y) coordinates
Parameters
----------
t: float, time
x: float, x-coordinate
y: float, y-coordinate
Raises
------
TFEx if out range
Yields
-------
The voxel (t, x, y) belong to
- write_tiff(self, tiffilespref='./ts_out')
- calls write_tiff(self, tiffilespref)
- write_tsm(self, picklefile='./ts_out.tsm')
- calls write_tsm(self, picklefile)
- write_txt(self, txtfile='./ts_out.txt')
- calls write_txt(self, txtfile)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __dataclass_fields__ = {}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
|
class TEvalEx(builtins.Exception) |
|
TEvalEx(ex)
The Timescape evaluation exception, not blocking. |
|
- Method resolution order:
- TEvalEx
- builtins.Exception
- builtins.BaseException
- builtins.object
Methods defined here:
- __init__(self, ex)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __weakref__
- list of weak references to the object (if defined)
Static methods inherited from builtins.Exception:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Methods inherited from builtins.BaseException:
- __delattr__(self, name, /)
- Implement delattr(self, name).
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __reduce__(...)
- Helper for pickle.
- __repr__(self, /)
- Return repr(self).
- __setattr__(self, name, value, /)
- Implement setattr(self, name, value).
- __setstate__(...)
- __str__(self, /)
- Return str(self).
- with_traceback(...)
- Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
Data descriptors inherited from builtins.BaseException:
- __cause__
- exception cause
- __context__
- exception context
- __dict__
- __suppress_context__
- __traceback__
- args
|
class TFEx(builtins.Exception) |
|
TFEx(ex)
The Timescape Fatal exception. |
|
- Method resolution order:
- TFEx
- builtins.Exception
- builtins.BaseException
- builtins.object
Methods defined here:
- __init__(self, ex)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __weakref__
- list of weak references to the object (if defined)
Static methods inherited from builtins.Exception:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Methods inherited from builtins.BaseException:
- __delattr__(self, name, /)
- Implement delattr(self, name).
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __reduce__(...)
- Helper for pickle.
- __repr__(self, /)
- Return repr(self).
- __setattr__(self, name, value, /)
- Implement setattr(self, name, value).
- __setstate__(...)
- __str__(self, /)
- Return str(self).
- with_traceback(...)
- Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
Data descriptors inherited from builtins.BaseException:
- __cause__
- exception cause
- __context__
- exception context
- __dict__
- __suppress_context__
- __traceback__
- args
|
class TimescapeEvaluator(builtins.object) |
|
TimescapeEvaluator(mod: timescape.Model = None, ews: [] = None, vox: timescape.Voxel = None) -> None
The interpolators class, one method per interpolator.
Attributes
----------
mod: Model, the Timescape model
ews: [EventWrapper], the causally connected source events with respect to vox
vox: Voxel, the target event to be interpolated
Methods
-------
KRIG: A simple 3d universal Kriging based on PyKrige
IDW: The sharp Inverse Distance Weighting
SIDW: A smoother Inverse Distance Weighting
MYINTERP: A skeleton method |
|
Methods defined here:
- IDW(self)
- The sharp Inverse Distance Weighting
The weight function is 1/d
Raises
------
TEvalEx if the target event evluation fails
Yields
-------
val: float, the event value
acc: float, the event accuracy, None unless distance = 0
- KRIG(self)
- A simple 3d universal Kriging based on PyKrige
Reference https://github.com/bsmurphy/PyKrige
Raises
------
TEvalEx if the target event evluation fails
Yields
-------
val: float, the event value
acc: float, the event accuracy
- MYINTERP(self)
- A mock interpolator - use as a skeleton for adding new interpolators
Keep everything enclosed in the try-except construct to log the exception and to mark the event as BAD
Use _logline('{} {}'.format(self.vox, 'text_to_log')) to log the 'text_to_log' string
Raises
------
TEvalEx if the target event evluation fails
Yields
-------
val: float, the event value
acc: float, the event accuracy
- SIDW(self)
- A smoother Inverse Distance Weighting
The weight function is 1/(d^2 + m^2)
where m^2 is the MYPAR_SIDW_SQMASS user-defined parameter
Raises
------
TEvalEx if the target event evluation fails
Yields
-------
val: float, the event value
acc: None, cannot estimate the event accuracy
- __eq__(self, other)
- __init__(self, mod: timescape.Model = None, ews: [] = None, vox: timescape.Voxel = None) -> None
- __repr__(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __annotations__ = {'ews': [], 'mod': <class 'timescape.Model'>, 'vox': <class 'timescape.Voxel'>}
- __dataclass_fields__ = {'ews': Field(name='ews',type=[],default=None,default_fa...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'mod': Field(name='mod',type=<class 'timescape.Model'>,...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'vox': Field(name='vox',type=<class 'timescape.Voxel'>,...rue,metadata=mappingproxy({}),_field_type=_FIELD)}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- ews = None
- mod = None
- vox = None
|
class Voxel(builtins.object) |
|
Voxel(k: int = None, i: int = None, j: int = None, t: float = None, ct: float = None, x: float = None, y: float = None, val: float = None, stdev: float = None, neigh: int = None, bad: bool = False) -> None
a target event |
|
Methods defined here:
- __eq__(self, other)
- __init__(self, k: int = None, i: int = None, j: int = None, t: float = None, ct: float = None, x: float = None, y: float = None, val: float = None, stdev: float = None, neigh: int = None, bad: bool = False) -> None
- __repr__(self)
- label(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __annotations__ = {'bad': <class 'bool'>, 'ct': <class 'float'>, 'i': <class 'int'>, 'j': <class 'int'>, 'k': <class 'int'>, 'neigh': <class 'int'>, 'stdev': <class 'float'>, 't': <class 'float'>, 'val': <class 'float'>, 'x': <class 'float'>, ...}
- __dataclass_fields__ = {'bad': Field(name='bad',type=<class 'bool'>,default=Fal...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'ct': Field(name='ct',type=<class 'float'>,default=Non...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'i': Field(name='i',type=<class 'int'>,default=None,d...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'j': Field(name='j',type=<class 'int'>,default=None,d...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'k': Field(name='k',type=<class 'int'>,default=None,d...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'neigh': Field(name='neigh',type=<class 'int'>,default=No...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'stdev': Field(name='stdev',type=<class 'float'>,default=...rue,metadata=mappingproxy({}),_field_type=_FIELD), 't': Field(name='t',type=<class 'float'>,default=None...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'val': Field(name='val',type=<class 'float'>,default=No...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'x': Field(name='x',type=<class 'float'>,default=None...rue,metadata=mappingproxy({}),_field_type=_FIELD), ...}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- bad = False
- ct = None
- i = None
- j = None
- k = None
- neigh = None
- stdev = None
- t = None
- val = None
- x = None
- y = None
| |