_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q274100
LockerServer._lock
test
def _lock(self, name, client_id, request_id): """Hanldes locking of locks If a lock is already locked sends a WAIT command, else LOCKs it and sends GO. Complains if a given client re-locks a lock without releasing it before. """ if name in self._locks: othe...
python
{ "resource": "" }
q274101
ReliableClient.send_done
test
def send_done(self): """Notifies the Server to shutdown""" self.start(test_connection=False) self._logger.debug('Sending shutdown signal') self._req_rep(ZMQServer.DONE)
python
{ "resource": "" }
q274102
ReliableClient.finalize
test
def finalize(self): """Closes socket and terminates context NO-OP if already closed. """ if self._context is not None: if self._socket is not None: self._close_socket(confused=False) self._context.term() self._context = None ...
python
{ "resource": "" }
q274103
ReliableClient.start
test
def start(self, test_connection=True): """Starts connection to server if not existent. NO-OP if connection is already established. Makes ping-pong test as well if desired. """ if self._context is None: self._logger.debug('Starting Client') self._context ...
python
{ "resource": "" }
q274104
ReliableClient._req_rep_retry
test
def _req_rep_retry(self, request): """Returns response and number of retries""" retries_left = self.RETRIES while retries_left: self._logger.log(1, 'Sending REQ `%s`', request) self._send_request(request) socks = dict(self._poll.poll(self.TIMEOUT)) ...
python
{ "resource": "" }
q274105
LockerClient.acquire
test
def acquire(self): """Acquires lock and returns `True` Blocks until lock is available. """ self.start(test_connection=False) while True: str_response, retries = self._req_rep_retry(LockerServer.LOCK) response = str_response.split(LockerServer.DELIMITER) ...
python
{ "resource": "" }
q274106
QueuingServerMessageListener.listen
test
def listen(self): """ Handles listening requests from the client. There are 4 types of requests: 1- Check space in the queue 2- Tests the socket 3- If there is a space, it sends data 4- after data is sent, puts it to queue for storing """ count = 0 ...
python
{ "resource": "" }
q274107
QueuingClient.put
test
def put(self, data, block=True): """ If there is space it sends data to server If no space in the queue It returns the request in every 10 millisecond until there will be space in the queue. """ self.start(test_connection=False) while True: respon...
python
{ "resource": "" }
q274108
ForkDetector._detect_fork
test
def _detect_fork(self): """Detects if lock client was forked. Forking is detected by comparing the PID of the current process with the stored PID. """ if self._pid is None: self._pid = os.getpid() if self._context is not None: current_pid = os.ge...
python
{ "resource": "" }
q274109
StorageServiceDataHandler._handle_data
test
def _handle_data(self, msg, args, kwargs): """Handles data and returns `True` or `False` if everything is done.""" stop = False try: if msg == 'DONE': stop = True elif msg == 'STORE': if 'msg' in kwargs: store_msg = kwar...
python
{ "resource": "" }
q274110
StorageServiceDataHandler.run
test
def run(self): """Starts listening to the queue.""" try: while True: msg, args, kwargs = self._receive_data() stop = self._handle_data(msg, args, kwargs) if stop: break finally: if self._storage_service.i...
python
{ "resource": "" }
q274111
QueueStorageServiceWriter._receive_data
test
def _receive_data(self): """Gets data from queue""" result = self.queue.get(block=True) if hasattr(self.queue, 'task_done'): self.queue.task_done() return result
python
{ "resource": "" }
q274112
PipeStorageServiceWriter._receive_data
test
def _receive_data(self): """Gets data from pipe""" while True: while len(self._buffer) < self.max_size and self.conn.poll(): data = self._read_chunks() if data is not None: self._buffer.append(data) if len(self._buffer) > 0: ...
python
{ "resource": "" }
q274113
LockWrapper.store
test
def store(self, *args, **kwargs): """Acquires a lock before storage and releases it afterwards.""" try: self.acquire_lock() return self._storage_service.store(*args, **kwargs) finally: if self.lock is not None: try: self.rel...
python
{ "resource": "" }
q274114
ReferenceWrapper.store
test
def store(self, msg, stuff_to_store, *args, **kwargs): """Simply keeps a reference to the stored data """ trajectory_name = kwargs['trajectory_name'] if trajectory_name not in self.references: self.references[trajectory_name] = [] self.references[trajectory_name].append((msg,...
python
{ "resource": "" }
q274115
ReferenceStore.store_references
test
def store_references(self, references): """Stores references to disk and may collect garbage.""" for trajectory_name in references: self._storage_service.store(pypetconstants.LIST, references[trajectory_name], trajectory_name=trajectory_name) self._check_and_collect_garbage()
python
{ "resource": "" }
q274116
parse_config
test
def parse_config(init_func): """Decorator wrapping the environment to use a config file""" @functools.wraps(init_func) def new_func(env, *args, **kwargs): config_interpreter = ConfigInterpreter(kwargs) # Pass the config data to the kwargs new_kwargs = config_interpreter.interpret() ...
python
{ "resource": "" }
q274117
ConfigInterpreter._collect_section
test
def _collect_section(self, section): """Collects all settings within a section""" kwargs = {} try: if self.parser.has_section(section): options = self.parser.options(section) for option in options: str_val = self.parser.get(section,...
python
{ "resource": "" }
q274118
ConfigInterpreter._collect_config
test
def _collect_config(self): """Collects all info from three sections""" kwargs = {} sections = ('storage_service', 'trajectory', 'environment') for section in sections: kwargs.update(self._collect_section(section)) return kwargs
python
{ "resource": "" }
q274119
ConfigInterpreter.interpret
test
def interpret(self): """Copies parsed arguments into the kwargs passed to the environment""" if self.config_file: new_kwargs = self._collect_config() for key in new_kwargs: # Already specified kwargs take precedence over the ini file if key not in ...
python
{ "resource": "" }
q274120
ConfigInterpreter.add_parameters
test
def add_parameters(self, traj): """Adds parameters and config from the `.ini` file to the trajectory""" if self.config_file: parameters = self._collect_section('parameters') for name in parameters: value = parameters[name] if not isinstance(value, ...
python
{ "resource": "" }
q274121
convert_rule
test
def convert_rule(rule_number): """ Converts a rule given as an integer into a binary list representation. It reads from left to right (contrary to the Wikipedia article given below), i.e. the 2**0 is found on the left hand side and 2**7 on the right. For example: ``convert_rule(30)`` returns ...
python
{ "resource": "" }
q274122
make_initial_state
test
def make_initial_state(name, ncells, seed=42): """ Creates an initial state for the automaton. :param name: Either ``'single'`` for a single live cell in the middle of the cell ring, or ``'random'`` for uniformly distributed random pattern of zeros and ones. :param ncells: Number of cells...
python
{ "resource": "" }
q274123
plot_pattern
test
def plot_pattern(pattern, rule_number, filename): """ Plots an automaton ``pattern`` and stores the image under a given ``filename``. For axes labels the ``rule_number`` is also required. """ plt.figure() plt.imshow(pattern) plt.xlabel('Cell No.') plt.ylabel('Time Step') plt.title('CA ...
python
{ "resource": "" }
q274124
cellular_automaton_1D
test
def cellular_automaton_1D(initial_state, rule_number, steps): """ Simulates a 1 dimensional cellular automaton. :param initial_state: The initial state of *dead* and *alive* cells as a 1D numpy array. It's length determines the size of the simulation. :param rule_number: The upda...
python
{ "resource": "" }
q274125
main
test
def main(): """ Main simulation function """ rules_to_test = [10, 30, 90, 110, 184] # rules we want to explore: steps = 250 # cell iterations ncells = 400 # number of cells seed = 100042 # RNG seed initial_states = ['single', 'random'] # Initial states we want to explore # create a fol...
python
{ "resource": "" }
q274126
NodeProcessingTimer.signal_update
test
def signal_update(self): """Signals the process timer. If more time than the display time has passed a message is emitted. """ if not self.active: return self._updates += 1 current_time = time.time() dt = current_time - self._last_time if dt...
python
{ "resource": "" }
q274127
HDF5StorageService._overview_group
test
def _overview_group(self): """Direct link to the overview group""" if self._overview_group_ is None: self._overview_group_ = self._all_create_or_get_groups('overview')[0] return self._overview_group_
python
{ "resource": "" }
q274128
HDF5StorageService.load
test
def load(self, msg, stuff_to_load, *args, **kwargs): """Loads a particular item from disk. The storage service always accepts these parameters: :param trajectory_name: Name of current trajectory and name of top node in hdf5 file. :param trajectory_index: If no `trajectory...
python
{ "resource": "" }
q274129
HDF5StorageService.store
test
def store(self, msg, stuff_to_store, *args, **kwargs): """ Stores a particular item to disk. The storage service always accepts these parameters: :param trajectory_name: Name or current trajectory and name of top node in hdf5 file :param filename: Name of the hdf5 file :param...
python
{ "resource": "" }
q274130
HDF5StorageService._srvc_load_several_items
test
def _srvc_load_several_items(self, iterable, *args, **kwargs): """Loads several items from an iterable Iterables are supposed to be of a format like `[(msg, item, args, kwarg),...]` If `args` and `kwargs` are not part of a tuple, they are taken from the current `args` and `kwargs` provi...
python
{ "resource": "" }
q274131
HDF5StorageService._srvc_check_hdf_properties
test
def _srvc_check_hdf_properties(self, traj): """Reads out the properties for storing new data into the hdf5file :param traj: The trajectory """ for attr_name in HDF5StorageService.ATTR_LIST: try: config = traj.f_get('config.hdf5.' + attr_name).f...
python
{ "resource": "" }
q274132
HDF5StorageService._srvc_store_several_items
test
def _srvc_store_several_items(self, iterable, *args, **kwargs): """Stores several items from an iterable Iterables are supposed to be of a format like `[(msg, item, args, kwarg),...]` If `args` and `kwargs` are not part of a tuple, they are taken from the current `args` and `kwargs` pro...
python
{ "resource": "" }
q274133
HDF5StorageService._srvc_closing_routine
test
def _srvc_closing_routine(self, closing): """Routine to close an hdf5 file The file is closed only when `closing=True`. `closing=True` means that the file was opened in the current highest recursion level. This prevents re-opening and closing of the file if `store` or `load` are called ...
python
{ "resource": "" }
q274134
HDF5StorageService._srvc_extract_file_information
test
def _srvc_extract_file_information(self, kwargs): """Extracts file information from kwargs. Note that `kwargs` is not passed as `**kwargs` in order to also `pop` the elements on the level of the function calling `_srvc_extract_file_information`. """ if 'filename' in kwargs: ...
python
{ "resource": "" }
q274135
HDF5StorageService._trj_backup_trajectory
test
def _trj_backup_trajectory(self, traj, backup_filename=None): """Backs up a trajectory. :param traj: Trajectory that should be backed up :param backup_filename: Path and filename of backup file. If None is specified the storage service defaults to `path_to_trajectory_h...
python
{ "resource": "" }
q274136
HDF5StorageService._trj_read_out_row
test
def _trj_read_out_row(colnames, row): """Reads out a row and returns a dictionary containing the row content. :param colnames: List of column names :param row: A pytables table row :return: A dictionary with colnames as keys and content as values """ result_dict = {} ...
python
{ "resource": "" }
q274137
HDF5StorageService._trj_prepare_merge
test
def _trj_prepare_merge(self, traj, changed_parameters, old_length): """Prepares a trajectory for merging. This function will already store extended parameters. :param traj: Target of merge :param changed_parameters: List of extended parameters (i.e. their names). """ ...
python
{ "resource": "" }
q274138
HDF5StorageService._trj_load_meta_data
test
def _trj_load_meta_data(self, traj, load_data, as_new, with_run_information, force): """Loads meta information about the trajectory Checks if the version number does not differ from current pypet version Loads, comment, timestamp, name, version from disk in case trajectory is not loaded ...
python
{ "resource": "" }
q274139
HDF5StorageService._tree_load_sub_branch
test
def _tree_load_sub_branch(self, traj_node, branch_name, load_data=pypetconstants.LOAD_DATA, with_links=True, recursive=False, max_depth=None, _trajectory=None, _as_new=False, _hdf5_group=None): ...
python
{ "resource": "" }
q274140
HDF5StorageService._trj_check_version
test
def _trj_check_version(self, version, python, force): """Checks for version mismatch Raises a VersionMismatchError if version of loaded trajectory and current pypet version do not match. In case of `force=True` error is not raised only a warning is emitted. """ curr_python = py...
python
{ "resource": "" }
q274141
HDF5StorageService._trj_fill_run_table
test
def _trj_fill_run_table(self, traj, start, stop): """Fills the `run` overview table with information. Will also update new information. """ def _make_row(info_dict): row = (info_dict['idx'], info_dict['name'], info_dict['time'], ...
python
{ "resource": "" }
q274142
HDF5StorageService._trj_load_exploration
test
def _trj_load_exploration(self, traj): """Recalls names of all explored parameters""" if hasattr(self._overview_group, 'explorations'): explorations_table = self._overview_group._f_get_child( 'explorations') for row in explorations_table.iterrows(): param_name = r...
python
{ "resource": "" }
q274143
HDF5StorageService._trj_store_explorations
test
def _trj_store_explorations(self, traj): """Stores a all explored parameter names for internal recall""" nexplored = len(traj._explored_parameters) if nexplored > 0: if hasattr(self._overview_group, 'explorations'): explorations_table = self._overview_group._f_get_chi...
python
{ "resource": "" }
q274144
HDF5StorageService._srvc_make_overview_tables
test
def _srvc_make_overview_tables(self, tables_to_make, traj=None): """Creates the overview tables in overview group""" for table_name in tables_to_make: # Prepare the tables desciptions, depending on which overview table we create # we need different columns paramdescri...
python
{ "resource": "" }
q274145
HDF5StorageService._trj_store_trajectory
test
def _trj_store_trajectory(self, traj, only_init=False, store_data=pypetconstants.STORE_DATA, max_depth=None): """ Stores a trajectory to an hdf5 file Stores all groups, parameters and results """ if not only_init: self._logger.info('Start stori...
python
{ "resource": "" }
q274146
HDF5StorageService._tree_store_sub_branch
test
def _tree_store_sub_branch(self, traj_node, branch_name, store_data=pypetconstants.STORE_DATA, with_links=True, recursive=False, max_depth=None, hdf5_group=None): ...
python
{ "resource": "" }
q274147
HDF5StorageService._tree_create_leaf
test
def _tree_create_leaf(self, name, trajectory, hdf5_group): """ Creates a new pypet leaf instance. Returns the leaf and if it is an explored parameter the length of the range. """ class_name = self._all_get_from_attrs(hdf5_group, HDF5StorageService.CLASS_NAME) # Create the inst...
python
{ "resource": "" }
q274148
HDF5StorageService._tree_load_nodes_dfs
test
def _tree_load_nodes_dfs(self, parent_traj_node, load_data, with_links, recursive, max_depth, current_depth, trajectory, as_new, hdf5_group): """Loads a node from hdf5 file and if desired recursively everything below :param parent_traj_node: The parent node whose child should b...
python
{ "resource": "" }
q274149
HDF5StorageService._tree_store_nodes_dfs
test
def _tree_store_nodes_dfs(self, parent_traj_node, name, store_data, with_links, recursive, max_depth, current_depth, parent_hdf5_group): """Stores a node to hdf5 and if desired stores recursively everything below it. :param parent_traj_node: The paren...
python
{ "resource": "" }
q274150
HDF5StorageService._all_store_param_or_result_table_entry
test
def _all_store_param_or_result_table_entry(self, instance, table, flags, additional_info=None): """Stores a single row into an overview table :param instance: A parameter or result instance :param table: Table where row will be inserted :...
python
{ "resource": "" }
q274151
HDF5StorageService._all_get_or_create_table
test
def _all_get_or_create_table(self, where, tablename, description, expectedrows=None): """Creates a new table, or if the table already exists, returns it.""" where_node = self._hdf5file.get_node(where) if not tablename in where_node: if not expectedrows is None: table...
python
{ "resource": "" }
q274152
HDF5StorageService._all_get_node_by_name
test
def _all_get_node_by_name(self, name): """Returns an HDF5 node by the path specified in `name`""" path_name = name.replace('.', '/') where = '/%s/%s' % (self._trajectory_name, path_name) return self._hdf5file.get_node(where=where)
python
{ "resource": "" }
q274153
HDF5StorageService._all_set_attributes_to_recall_natives
test
def _all_set_attributes_to_recall_natives(data, ptitem, prefix): """Stores original data type to hdf5 node attributes for preserving the data type. :param data: Data to be stored :param ptitem: HDF5 node to store data types as attributes. Can also be just a PTItemMock...
python
{ "resource": "" }
q274154
HDF5StorageService._all_recall_native_type
test
def _all_recall_native_type(self, data, ptitem, prefix): """Checks if loaded data has the type it was stored in. If not converts it. :param data: Data item to be checked and converted :param ptitem: HDf5 Node or Leaf from where data was loaded :param prefix: Prefix for recalling the dat...
python
{ "resource": "" }
q274155
HDF5StorageService._all_add_or_modify_row
test
def _all_add_or_modify_row(self, item_name, insert_dict, table, index=None, condition=None, condvars=None, flags=(ADD_ROW, MODIFY_ROW,)): """Adds or changes a row in a pytable. :param item_name: Name of item, the row is about, only important...
python
{ "resource": "" }
q274156
HDF5StorageService._all_insert_into_row
test
def _all_insert_into_row(self, row, insert_dict): """Copies data from `insert_dict` into a pytables `row`.""" for key, val in insert_dict.items(): try: row[key] = val except KeyError as ke: self._logger.warning('Could not write `%s` into a table, '...
python
{ "resource": "" }
q274157
HDF5StorageService._all_extract_insert_dict
test
def _all_extract_insert_dict(self, item, colnames, additional_info=None): """Extracts information from a given item to be stored into a pytable row. Items can be a variety of things here, trajectories, single runs, group node, parameters, results. :param item: Item from which data shou...
python
{ "resource": "" }
q274158
HDF5StorageService._all_cut_string
test
def _all_cut_string(string, max_length, logger): """Cuts string data to the maximum length allowed in a pytables column if string is too long. :param string: String to be cut :param max_length: Maximum allowed string length :param logger: Logger where messages about truncating s...
python
{ "resource": "" }
q274159
HDF5StorageService._all_create_or_get_group
test
def _all_create_or_get_group(self, name, parent_hdf5_group=None): """Creates or returns a group""" if not name in parent_hdf5_group: new_hdf5_group = self._hdf5file.create_group(where=parent_hdf5_group, name=name, ...
python
{ "resource": "" }
q274160
HDF5StorageService._all_create_or_get_groups
test
def _all_create_or_get_groups(self, key, start_hdf5_group=None): """Creates new or follows existing group nodes along a given colon separated `key`. :param key: Colon separated path along hdf5 file, e.g. `parameters.mobiles.cars`. :param start_hdf5_group: HDF5 group f...
python
{ "resource": "" }
q274161
HDF5StorageService._ann_store_annotations
test
def _ann_store_annotations(self, item_with_annotations, node, overwrite=False): """Stores annotations into an hdf5 file.""" # If we overwrite delete all annotations first if overwrite is True or overwrite == 'v_annotations': annotated = self._all_get_from_attrs(node, HDF5StorageServ...
python
{ "resource": "" }
q274162
HDF5StorageService._ann_load_annotations
test
def _ann_load_annotations(self, item_with_annotations, node): """Loads annotations from disk.""" annotated = self._all_get_from_attrs(node, HDF5StorageService.ANNOTATED) if annotated: annotations = item_with_annotations.v_annotations # You can only load into non-empty...
python
{ "resource": "" }
q274163
HDF5StorageService._grp_store_group
test
def _grp_store_group(self, traj_group, store_data=pypetconstants.STORE_DATA, with_links=True, recursive=False, max_depth=None, _hdf5_group=None, _newly_created=False): """Stores a group node. For group nodes only annotations and comments need to be stor...
python
{ "resource": "" }
q274164
HDF5StorageService._grp_load_group
test
def _grp_load_group(self, traj_group, load_data=pypetconstants.LOAD_DATA, with_links=True, recursive=False, max_depth=None, _traj=None, _as_new=False, _hdf5_group=None): """Loads a group node and potentially everything recursively below""" if _hdf5_group i...
python
{ "resource": "" }
q274165
HDF5StorageService._all_load_skeleton
test
def _all_load_skeleton(self, traj_node, hdf5_group): """Reloads skeleton data of a tree node""" if traj_node.v_annotations.f_is_empty(): self._ann_load_annotations(traj_node, hdf5_group) if traj_node.v_comment == '': comment = self._all_get_from_attrs(hdf5_group, HDF5Stor...
python
{ "resource": "" }
q274166
HDF5StorageService._prm_extract_missing_flags
test
def _prm_extract_missing_flags(data_dict, flags_dict): """Extracts storage flags for data in `data_dict` if they were not specified in `flags_dict`. See :const:`~pypet.storageservice.HDF5StorageService.TYPE_FLAG_MAPPING` for how to store different types of data per default. """...
python
{ "resource": "" }
q274167
HDF5StorageService._prm_meta_add_summary
test
def _prm_meta_add_summary(self, instance): """Adds data to the summary tables and returns if `instance`s comment has to be stored. Also moves comments upwards in the hierarchy if purge_duplicate_comments is true and a lower index run has completed. Only necessary for *multiprocessing*. ...
python
{ "resource": "" }
q274168
HDF5StorageService._prm_add_meta_info
test
def _prm_add_meta_info(self, instance, group, overwrite=False): """Adds information to overview tables and meta information to the `instance`s hdf5 `group`. :param instance: Instance to store meta info about :param group: HDF5 group of instance :param overwrite: If data should b...
python
{ "resource": "" }
q274169
HDF5StorageService._prm_store_from_dict
test
def _prm_store_from_dict(self, fullname, store_dict, hdf5_group, store_flags, kwargs): """Stores a `store_dict`""" for key, data_to_store in store_dict.items(): # self._logger.log(1, 'SUB-Storing %s [%s]', key, str(store_dict[key])) original_hdf5_group = None flag = ...
python
{ "resource": "" }
q274170
HDF5StorageService._prm_store_parameter_or_result
test
def _prm_store_parameter_or_result(self, instance, store_data=pypetconstants.STORE_DATA, store_flags=None, overwrite=None, wi...
python
{ "resource": "" }
q274171
HDF5StorageService._prm_write_shared_array
test
def _prm_write_shared_array(self, key, data, hdf5_group, full_name, flag, **kwargs): """Creates and array that can be used with an HDF5 array object""" if flag == HDF5StorageService.ARRAY: self._prm_write_into_array(key, data, hdf5_group, full_name, **kwargs) elif flag in (HDF5Stora...
python
{ "resource": "" }
q274172
HDF5StorageService._prm_write_shared_table
test
def _prm_write_shared_table(self, key, hdf5_group, fullname, **kwargs): """Creates a new empty table""" first_row = None description = None if 'first_row' in kwargs: first_row = kwargs.pop('first_row') if not 'description' in kwargs: description = ...
python
{ "resource": "" }
q274173
HDF5StorageService._prm_write_dict_as_table
test
def _prm_write_dict_as_table(self, key, data_to_store, group, fullname, **kwargs): """Stores a python dictionary as pytable :param key: Name of data item to store :param data_to_store: Dictionary to store :param group: Group node where to store d...
python
{ "resource": "" }
q274174
HDF5StorageService._prm_write_pandas_data
test
def _prm_write_pandas_data(self, key, data, group, fullname, flag, **kwargs): """Stores a pandas DataFrame into hdf5. :param key: Name of data item to store :param data: Pandas Data to Store :param group: Group node where to store data in hdf5 fi...
python
{ "resource": "" }
q274175
HDF5StorageService._prm_write_into_other_array
test
def _prm_write_into_other_array(self, key, data, group, fullname, flag, **kwargs): """Stores data as carray, earray or vlarray depending on `flag`. :param key: Name of data item to store :param data: Data to store :param gr...
python
{ "resource": "" }
q274176
HDF5StorageService._prm_write_into_array
test
def _prm_write_into_array(self, key, data, group, fullname, **kwargs): """Stores data as array. :param key: Name of data item to store :param data: Data to store :param group: Group node where to store data in hdf5 file :param fullname: ...
python
{ "resource": "" }
q274177
HDF5StorageService._lnk_delete_link
test
def _lnk_delete_link(self, link_name): """Removes a link from disk""" translated_name = '/' + self._trajectory_name + '/' + link_name.replace('.','/') link = self._hdf5file.get_node(where=translated_name) link._f_remove()
python
{ "resource": "" }
q274178
HDF5StorageService._all_delete_parameter_or_result_or_group
test
def _all_delete_parameter_or_result_or_group(self, instance, delete_only=None, remove_from_item=False, recursive=False, _hdf...
python
{ "resource": "" }
q274179
HDF5StorageService._prm_write_into_pytable
test
def _prm_write_into_pytable(self, tablename, data, hdf5_group, fullname, **kwargs): """Stores data as pytable. :param tablename: Name of the data table :param data: Data to store :param hdf5_group: Group node where to store data in hdf5 file ...
python
{ "resource": "" }
q274180
HDF5StorageService._prm_make_description
test
def _prm_make_description(self, data, fullname): """ Returns a description dictionary for pytables table creation""" def _convert_lists_and_tuples(series_of_data): """Converts lists and tuples to numpy arrays""" if isinstance(series_of_data[0], (list, t...
python
{ "resource": "" }
q274181
HDF5StorageService._all_get_table_col
test
def _all_get_table_col(self, key, column, fullname): """ Creates a pytables column instance. The type of column depends on the type of `column[0]`. Note that data in `column` must be homogeneous! """ val = column[0] try: # # We do not want to loose int_ ...
python
{ "resource": "" }
q274182
HDF5StorageService._prm_get_longest_stringsize
test
def _prm_get_longest_stringsize(string_list): """ Returns the longest string size for a string entry across data.""" maxlength = 1 for stringar in string_list: if isinstance(stringar, np.ndarray): if stringar.ndim > 0: for string in stringar.ravel...
python
{ "resource": "" }
q274183
HDF5StorageService._prm_load_into_dict
test
def _prm_load_into_dict(self, full_name, load_dict, hdf5_group, instance, load_only, load_except, load_flags, _prefix = ''): """Loads into dictionary""" for node in hdf5_group: load_type = self._all_get_from_attrs(node, HDF5StorageService.STORAGE_TYPE) ...
python
{ "resource": "" }
q274184
HDF5StorageService._prm_read_dictionary
test
def _prm_read_dictionary(self, leaf, full_name): """Loads data that was originally a dictionary when stored :param leaf: PyTables table containing the dictionary data :param full_name: Full name of the parameter or result whose data is to be loaded :return: ...
python
{ "resource": "" }
q274185
HDF5StorageService._prm_read_shared_data
test
def _prm_read_shared_data(self, shared_node, instance): """Reads shared data and constructs the appropraite class. :param shared_node: hdf5 node storing the pandas DataFrame :param full_name: Full name of the parameter or result whose data is to be loaded :re...
python
{ "resource": "" }
q274186
HDF5StorageService._prm_read_table
test
def _prm_read_table(self, table_or_group, full_name): """Reads a non-nested PyTables table column by column and created a new ObjectTable for the loaded data. :param table_or_group: PyTables table to read from or a group containing subtables. :param full_name: ...
python
{ "resource": "" }
q274187
HDF5StorageService._prm_read_array
test
def _prm_read_array(self, array, full_name): """Reads data from an array or carray :param array: PyTables array or carray to read from :param full_name: Full name of the parameter or result whose data is to be loaded :return: Data to load ...
python
{ "resource": "" }
q274188
load_trajectory
test
def load_trajectory(name=None, index=None, as_new=False, load_parameters=pypetconstants.LOAD_DATA, load_derived_parameters=pypetconstants.LOAD_SKELETON, load_results=pypetconstants.LOAD_SKELETON, load...
python
{ "resource": "" }
q274189
make_set_name
test
def make_set_name(idx): """Creates a run set name based on ``idx``""" GROUPSIZE = 1000 set_idx = idx // GROUPSIZE if set_idx >= 0: return pypetconstants.FORMATTED_SET_NAME % set_idx else: return pypetconstants.SET_NAME_DUMMY
python
{ "resource": "" }
q274190
Trajectory.f_set_properties
test
def f_set_properties(self, **kwargs): """Sets properties like ``v_fast_access``. For example: ``traj.f_set_properties(v_fast_access=True, v_auto_load=False)`` """ for name in kwargs: val = kwargs[name] if not name.startswith('v_'): name = 'v_' + ...
python
{ "resource": "" }
q274191
Trajectory.f_add_to_dynamic_imports
test
def f_add_to_dynamic_imports(self, dynamic_imports): """Adds classes or paths to classes to the trajectory to create custom parameters. :param dynamic_imports: If you've written custom parameter that needs to be loaded dynamically during runtime, this needs to be specified here...
python
{ "resource": "" }
q274192
Trajectory.f_set_crun
test
def f_set_crun(self, name_or_idx): """Can make the trajectory behave as during a particular single run. It allows easier data analysis. Has the following effects: * `v_idx` and `v_crun` are set to the appropriate index and run name * All explored para...
python
{ "resource": "" }
q274193
Trajectory.f_iter_runs
test
def f_iter_runs(self, start=0, stop=None, step=1, yields='name'): """Makes the trajectory iterate over all runs. :param start: Start index of run :param stop: Stop index, leave ``None`` for length of trajectory :param step: Stepsize :param yields: What should be ...
python
{ "resource": "" }
q274194
Trajectory.f_shrink
test
def f_shrink(self, force=False): """ Shrinks the trajectory and removes all exploration ranges from the parameters. Only possible if the trajectory has not been stored to disk before or was loaded as new. :param force: Usually you cannot shrink the trajectory if it has been stored ...
python
{ "resource": "" }
q274195
Trajectory._preset
test
def _preset(self, name, args, kwargs): """Generic preset function, marks a parameter or config for presetting.""" if self.f_contains(name, shortcuts=False): raise ValueError('Parameter `%s` is already part of your trajectory, use the normal' 'accessing routine to...
python
{ "resource": "" }
q274196
Trajectory.f_preset_parameter
test
def f_preset_parameter(self, param_name, *args, **kwargs): """Presets parameter value before a parameter is added. Can be called before parameters are added to the Trajectory in order to change the values that are stored into the parameter on creation. After creation of a parameter, th...
python
{ "resource": "" }
q274197
Trajectory._prepare_experiment
test
def _prepare_experiment(self): """Called by the environment to make some initial configurations before performing the individual runs. Checks if all parameters marked for presetting were preset. If not raises a DefaultReplacementError. Locks all parameters. Removal of ...
python
{ "resource": "" }
q274198
Trajectory.f_get_from_runs
test
def f_get_from_runs(self, name, include_default_run=True, use_indices=False, fast_access=False, with_links = True, shortcuts=True, max_depth=None, auto_load=False): """Searches for all occurrences of `name` in each run. Generates an ordered dictionary wit...
python
{ "resource": "" }
q274199
Trajectory._is_completed
test
def _is_completed(self, name_or_id=None): """Private function such that it can still be called by the environment during a single run""" if name_or_id is None: return all( (runinfo['completed'] for runinfo in self._run_information.values())) else: ...
python
{ "resource": "" }