Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.h5store.file.remove_node(self.where, self.routes_flows)
except tables.NoSuchNodeError:
pass
finally:
self._routes_flow_array = self.h5store.file.create_carray(self.where, self.routes_flows, atom, shape, createparents=True)
# Create routes table. This must be done in reset
if self.routes is not None:
group_name, node_name = self.routes.rsplit('/', 1)
if group_name == "":
group_name = "/"
description = {
# TODO make string length configurable
'start': tables.StringCol(1024),
'end': tables.StringCol(1024),
}
try:
self.h5store.file.remove_node(group_name, node_name)
except tables.NoSuchNodeError:
pass
finally:
tbl = self.h5store.file.create_table(group_name, node_name, description=description, createparents=True)
entry = tbl.row
for route in self.model.solver.routes:
node_first = route[0]
node_last = route[-1]
if node_first.parent is not None:
node_first = node_first.parent
if node_last.parent is not None:
# WATER QUALITY CONFIGURATION
#
class ReactionTable(IsDescription):
net_label = StringCol(64)
reaction_type = EnumCol(reaction_type, 'BULK', base='uint8')
value = Float32Col()
class SourcesTable(IsDescription):
node_label = StringCol(64)
source_type = EnumCol(source_type, 'CONCEN', base='uint8')
strength = Float32Col()
source_pattern = StringCol(72)
class MixingTable(IsDescription):
tank_label = StringCol(64)
mixing_model = EnumCol(mixing_model, 'MIXED', base='uint8')
mixing_volume = Float32Col()
class InitialQualityTable(IsDescription):
node_label = StringCol(64)
node_quality = Float32Col()
class WNMTablesFile(object):
def __init__(self, filename):
self._filename = filename
self._network = None
self.num_links = 0
self.num_nodes = 0
def add_meta(simulation, key):
"""Create a node for the simulation and add data to /Metadata"""
class Meta(tbl.IsDescription):
SID = tbl.StringCol(itemsize=16)
path = tbl.StringCol(itemsize=160)
log_analysed = tbl.BoolCol()
successful = tbl.BoolCol()
algorithm = tbl.StringCol(itemsize=16)
cpu_time = tbl.Float32Col()
successful_steps = tbl.Int32Col()
steps_nok = tbl.Int32Col()
timed_out = tbl.BoolCol()
perc_wrong = tbl.Float32Col()
time_events_model = tbl.Int32Col()
time_events_U = tbl.Int32Col()
state_events = tbl.Int32Col()
step_events = tbl.Int32Col()
step_size_min = tbl.Float32Col()
step_size_max = tbl.Float32Col()
int_order_max = tbl.Int32Col()
symbol_name = tables.StringCol(255) # symbol name in code
symbol_elf_name = tables.StringCol(255) # symbol name in elf filie
region_type = tables.EnumCol(region_types, BOOKKEEPING, base='uint8')
substagenum = tables.UInt8Col()
new = tables.BoolCol()
defined = tables.BoolCol()
undefined = tables.BoolCol()
writable = tables.BoolCol()
reclassified = tables.BoolCol()
allowed_symbol = tables.BoolCol()
do_print = tables.BoolCol()
class SubstageContents(tables.IsDescription):
substagenum = tables.UInt8Col(pos=1)
functionname = tables.StringCol(255, pos=2)
class SubstageEntry(tables.IsDescription):
substagenum = tables.UInt8Col(pos=1)
functionname = tables.StringCol(255)
name = tables.StringCol(255)
stack = tables.StringCol(255)
comments = tables.StringCol(255)
substage_type = tables.EnumCol(substage_types,
BOOKKEEPING, base='uint8')
class SubstageWriteIntervals(tables.IsDescription):
substagenum = tables.UInt8Col()
minaddr = tables.UInt64Col()
minaddrlo = tables.UInt32Col()
TARGET = tables.StringCol(72)
SOURCEK = tables.FloatCol()
SOURCEM = tables.FloatCol()
FILTER = tables.StringCol(72)
CELL = tables.FloatCol(shape=(2,6))
MATRIX = tables.FloatCol(shape=(2,9))
LOWTEMP = tables.IntCol(shape=(1,3))
ZOOM = tables.FloatCol(shape=(1,3))
CENTER = tables.FloatCol(shape=(1,4))
DISTANC = tables.FloatCol(shape=(1,2)) #has to be observed
TRAILER = tables.IntCol()
COMPRES = tables.StringCol(72)
LINEAR = tables.StringCol(72)
PHD = tables.FloatCol(shape=(1,2))
PREAMP = tables.FloatCol(shape=(1,2)) #has to be observed
CORRECT = tables.StringCol(72)
WARPFIL = tables.StringCol(72)
WAVELEN = tables.FloatCol(shape=(1,4))
MAXXY = tables.FloatCol(shape=(1,2))
AXIS = tables.IntCol()
ENDING = tables.FloatCol(shape=(1,4))
DETPAR = tables.FloatCol(shape=(2,6))
LUT = tables.StringCol(72)
DISPLIM = tables.FloatCol(shape=(1,2))
PROGRAM = tables.StringCol(72)
ROTATE = tables.IntCol()
BITMASK = tables.StringCol(72)
OCTMASK = tables.IntCol(shape=(2,8))
ESDCELL = tables.FloatCol(shape=(2,6))
DETTYPE = tables.StringCol(72)
NEXP = tables.IntCol(shape=(1,5))
CCDPARM = tables.FloatCol(shape=(1,5))
def get_groups_description():
groups_description = OrderedDict([
('group', tables.UInt8Col()),
# ('color', tables.UInt8Col()),
('name', tables.StringCol(64)),])
return groups_description
ayjid = tables.StringCol(200)
doi = tables.StringCol(100)
pmid = tables.StringCol(100)
wosid = tables.StringCol(100)
abstract = tables.StringCol(5000)
contents = tables.StringCol(100000)
accession = tables.StringCol(100)
date = tables.Int32Col()
citations = tables.StringCol(5000) # List of citation keys.
class Index(tables.IsDescription):
"""
For storing int : str pairs.
"""
i = tables.Int32Col()
mindex = tables.StringCol(1000)
class IntIndex(tables.IsDescription):
"""
For storing int : int pairs.
"""
i = tables.Int32Col()
mindex = tables.Int32Col()
class StrIndex(tables.IsDescription):
"""
For storing str : str pairs.
"""
i = tables.StringCol(100)
mindex = tables.StringCol(100000)
class HDF5Axes(dict):
class time (tables.IsDescription):
''' Time, either epoch or human readable '''
type_s = tables.StringCol(
8) # 'EPOCH', 'ASCII', or 'BOTH'
epoch_l = tables.Int64Col() # Seconds since January 1, 1970
ascii_s = tables.StringCol(32) # WWW MMM DD HH:MM:SS YYYY
micro_seconds_i = tables.Int32Col()
#
event_number_i = tables.Int32Col() # Event number
channel_number_i = tables.Int8Col() # Channel number
sample_rate_i = tables.Int16Col() # Trace sample rate
# This will be needed for sample rates < 1 sps
sample_rate_multiplier_i = tables.Int16Col()
sample_count_i = tables.Int32Col() # Version 2007.191a bleeding
stream_number_i = tables.Int8Col() # Stream
raw_file_name_s = tables.StringCol(32) # Original file name
# Name of array that contains trace
array_name_data_a = tables.StringCol(16)
array_name_SOH_a = tables.StringCol(16) # The SOH array name
array_name_event_a = tables.StringCol(16) # The event table array
array_name_log_a = tables.StringCol(16) # The log array
# Sample rate, int sample interval like SEGY (micro-seconds) or like SEED
# (BLOCKETTE 100)?
class Time (tables.IsDescription):
''' Time correction table '''
class das (tables.IsDescription):
manufacturer_s = tables.StringCol(64, pos=3)
model_s = tables.StringCol(64, pos=2)
serial_number_s = tables.StringCol(64, pos=1)
import tables as pt #@UnresolvedImport
import time
#I DON'T THINK THIS FILE IS NEEDED ANYMORE SHREYAS JOSHI 22 JUN 2010
class StrategyDataModel(pt.IsDescription):
symbol = pt.StringCol(30) #30 char string; Ticker
exchange = pt.StringCol(10) #10 char string; NYSE, NASDAQ, etc.
adj_high = pt.Float32Col()
adj_low = pt.Float32Col()
adj_open = pt.Float32Col()
adj_close = pt.Float32Col()
close = pt.Float32Col()
volume = pt.Int32Col()
timestamp = pt.Time64Col()
date = pt.Int32Col()
interval = pt.Time64Col()
def __init__(selfparams):
print "In the constructor"
#constructor done
def generateDataFile():
# increment step, update_history should handle the rest
step = self.step+1
name = self.current[step]['step_name']
self.update_history('step', name, step)
class History_Table(tables.IsDescription):
# Class to describe parameter and protocol change history
# Columns:
# Timestamp
# Type of change - protocol, parameter, step
# Name - Which parameter was changed, name of protocol, manual vs. graduation step change
# Value - What was the parameter/protocol/etc. changed to, step if protocol.
time = tables.StringCol(256)
type = tables.StringCol(256)
name = tables.StringCol(256)
value = tables.StringCol(4028)
class Weight_Table(tables.IsDescription):
start = tables.Float32Col()
stop = tables.Float32Col()
date = tables.StringCol(256)
session = tables.Int32Col()
class Hash_Table(tables.IsDescription):
time = tables.StringCol(256)
hash = tables.StringCol(40)
############################################################################################
# Utility functions and classes