Name | bamboost JSON |
Version |
0.8.2
JSON |
| download |
home_page | None |
Summary | A light weight database manager using HDF5 |
upload_time | 2024-11-13 14:32:22 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | Copyright (c) 2023 CMBM, ETH Zurich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
hdf5
database
database-manager
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
<h3 align="center">
<img src="https://gitlab.com/cmbm-ethz/bamboost/-/raw/main/assets/bamboost_icon.png?ref_type=heads" width="150" alt="Logo"/><br/>
<br/>
BAMBOOST <br/>
</h3>
<p align="center">
Bamboost is a Python library built for datamanagement using
the HDF5 file format.
bamboost stands for a <span style="font-weight: bold;">lightweight</span> shelf which will <span style="font-weight: bold">boost</span> your efficiency and which
will totally break if you load it heavily. Just kidding, bamboo can fully carry pandas. <br/>
🐼🐼🐼🐼
</p>
</div>
<div align="center">
<a href="https://bamboost.ch">
<img src="https://img.shields.io/badge/Docs-bamboost.ch-blue" alt="Website">
</a>
<!-- <a href="https://gitlab.com/cmbm-ethz/bamboost/-/commits/main"> -->
<!-- <img src="https://gitlab.com/cmbm-ethz/bamboost/badges/main/pipeline.svg" alt="pipeline status"> -->
<!-- </a> -->
<!-- <a href="https://gitlab.com/cmbm-ethz/bamboost/-/commits/main"> -->
<!-- <img src="https://gitlab.com/cmbm-ethz/bamboost/badges/main/coverage.svg" alt="coverage report"> -->
<!-- </a> -->
<a href="https://badge.fury.io/py/bamboost">
<img src="https://badge.fury.io/py/bamboost.svg" alt="PyPI version">
</a>
<a href="https://pypistats.org/packages/bamboost">
<img src="https://img.shields.io/pypi/dm/bamboost" alt="PyPI - Downloads">
</a>
<a href="https://pypi.org/project/bamboost/">
<img src="https://img.shields.io/pypi/pyversions/bamboost" alt="PyPI - Python Version">
</a>
<a href="https://gitlab.com/cmbm-ethz/bamboost/-/blob/main/LICENSE">
<img src="https://img.shields.io/pypi/l/bamboost" alt="PyPI - License">
</a>
<a href="https://gitlab.com/cmbm-ethz/bamboost/-/commits/test-ci"><img alt="pipeline status" src="https://gitlab.com/cmbm-ethz/bamboost/badges/test-ci/pipeline.svg" /></a>
<a href="https://gitlab.com/cmbm-ethz/bamboost/-/commits/test-ci"><img alt="coverage report" src="https://gitlab.com/cmbm-ethz/bamboost/badges/test-ci/coverage.svg" /></a>
Terminal user interface for bamboost: https://gitlab.com/zrlf/bamboost-tui.
Documentation site: https://gitlab.com/zrlf/bamboost-docs.
</div>
## Installation
Install the latest release from the package repository:
```
pip install bamboost
```
Install the package in editable mode for more flexibility, $e.g.$ if you plan to make changes yourself:
```
git clone git@gitlab.com:cmbm-ethz/bamboost.git
cd bamboost
pip install -e .
```
> :warning: The option `-e` installs a project in editable mode from a local path. This way,
> you won't need to reinstall when pulling a new version or changing something in the
> package.
### MPI support
For parallel writing, you need `mpi4py`. Furthermore, the HDF5 library must have
been built with MPI support and the python interface `h5py` must be installed
with parallel support (https://docs.h5py.org/en/stable/mpi.html).
```
export CC=mpicc
export HDF5_MPI="ON"
pip install --force-reinstall --no-deps --no-binary=h5py h5py
```
> :warning: If you're system runs into problems installing `mpi4py`, make sure python header files are installed. Quickly google what you need (something like `python3-dev`, `libpython3.8-dev`, etc.).
## Requirements
- **Python** >= 3.7
- **HDF5** >= 1.10.0
- **sqlite3** (comes with python) >= 3.0
Optional:
- **MPICC** or **OpenMPI** for parallel writing
- **HDF5** with MPI support
## Usage
### Manager
The main object of `bamboost` is the `Manager`. It manages the database located in the directory
specified during construction. It can display the parametric space, create new simulations, remove simulations
select a specific simulation based on it's `uid` or on conditions of it's parameters.
Every database that is created is assigned a unique identifier (UID).
```python
from bamboost import Manager
db = Manager('path/to/db')
```
`pandas.DataFrame` is used to display the database. The dataframe is convenient and fast to filter or sort your entries:
```python
db.df
```
An entry (from now on called *simulation*) within a database can be viewed, retrieved and modified with the `Simulation` object.
To get the `Simulation` object, access it with it's identifier or location (index) in the dataframe:
```python
sim = db['uid']
sim = db[index]
sim = db.sim('uid')
```
All simulations can be returned as a (sorted) list. The argument `select` can be used to
filter the simulations.
```python
sims = db.sims() # returns all
sims = db.sims(select=(db.df.eps==1)) # returns all where eps is 1
sims = db.sims(sort='parameter1', reverse=False) # returns all, sorrted by parameter1
```
:warning: Note that this creates objects for every simulation and the sorting is not optimized. Using pandas to select and sort is much faster. Check their documentation for how to manipulate pandas dataframes.
### Database index
Every database created will be assigned a unique identifier (UID).
The database path is stored with the UID in an index maintained at `~.config/bamboost` in your home directory. If it is not known, `bamboost` will try to find it on your disk (you can add paths to search in `~.config/bamboost/known_paths.json`).
You can obtain a Manager object of any database from anywhere with it's UID. In notebooks, key completion will show you all known databases:
```python
db = Manager.fromUID['UID']
```
The unique id makes refering to data safe. The full identifier of a simulation is considered to be `'(database id):(simulation id)'`. It is encouraged to use the identifiers (instead of the path) to link from one simulation to a different one.
```python
# add a link to a different simulation (e.g. the mesh)
sim.links['mesh_to_use'] = 'DATABASE-ID:simulation-id'
# the full id of a simulation is accessible as such
uid = sim.get_full_uid()
```
### Write data
You can use `bamboost` to write simulation or experimental data.
Use the `Manager` to create a new simulation (or access an existing one).
Say you have (or want to create) a database at `data_path`.
The code samples below shows the main functionality.
```python
from bamboost import Manager
db = Manager(data_path)
params = {...} # dictionary of parameters (can have nested dictionaries)
writer = db.create_simulation(parameters=params)
writer.copy_file('path/to/file/') # copy a file which is needed to the database folder (e.g. executable, module list, etc.)
writer.change_note('This run is part of a series in which i investigate the effect of worms on apples')
# Use context manager (with block) and the file will be tagged 'running', 'finished', 'failed' automatically
with writer:
writer.add_metadata() # adds time and other metadata
writer.add_mesh(coordinates, connectivity) # Add a mesh, default mesh is named 'mesh'.
writer.add_mesh(coordinates, connectivity, mesh_name='interface') # add a second mesh for e.g. the interface
# loop through your time data and write
for t in times:
writer.add_field('field_data_1', array, time=t)
writer.add_field('field_data_2', array, time=t, mesh='interface')
writer.add_global_field('kinetic_energy', some_number)
writer.finish_step() # this increases the step counter
```
If you have an existing dataset, $e.g.$ because you created the simulation before and it holds the input parameters or similar. Do the following: You will need to pass the path and the uid to the script (best use `argparse`).
```python
from bamboost import SimulationWriter
with SimulationWriter(path, uid) as writer:
# Do anything
```
#### Userdata (Data not related to time and/or space)
The above functionality should be used for ordered data, such as timeseries of spatial data related to a mesh.
For anything else, there is the `userdata` category. You can use it to store (almost) anything in the simulation file structured how you would like it. This is also useful to store computed values during postprocessing or plotting.
Internally, Userdata is an object handling a specific group ('/userdata') of the hdf5 file. To show the content of the group, display the object:
```python
sim.userdata
```
You can create a subgroup, which will return a self-similar object for the new group ($e.g.$ '/userdata/plots'):
```python
plot_grp = sim.userdata.require_group('plots')
```
Writing something to the file (group) is as easy as:
```python
sim.userdata['avg_T'] = 34.56256
sim.userdata['traction_profile'] = np.array([...])
```
And reading:
```python
# read avg_T
sim.userdata['avg_T']
# read dataset traction_profile
sim.userdata['traction_profile']
# note that this returns an object Dataset. To actually read the array, you will need to slice it
sim.userdata['traction_profile'][:]
```
### Read data
The key purpose is convenient access to data. I recommend an interactive session (notebooks).
#### Display database
```python
from bamboost import Manager
db = Manager(data_path)
```
To display the database with its parametric space simply input
```python
db.df
```
Select a simulation of your dataset. `sim` will be a `SimulationReader` object.
```python
sim = db[index]
sim = db[uid]
sims = db.sims((db.df.param1==2) & (db.df.param2>0), sort='param2') # will return list of all matching, sorted by param2
```
**Show data stored:**
Display content of the data, userdata, globals groups:
```
sim.data
sim.userdata
sim.globals
```
This displays the stored fields and its sizes.
```python
sim.data.info
```
**Access a mesh:** Directly access a tuple where [0] is the coordinates, [1] is the connectivity.
```python
coords, conn = sim.mesh # default mesh
coords, conn = sim.get_mesh(mesh_name=...)
```
You can get a mesh object the following way.
```python
mesh1 = sim.meshes['mesh1']
mesh1.coordinates # gives coordinates
mesh1.connectivity # gives connectivity
mesh1.get_tuple() # gives both the above
```
**Access field data**:
`sim.data` acts as an accessor for all field data.
```python
field1 = sim.data['field1']
field1[:], field1[0, :] # slice the dataset and you get numpy arrays (time, *spatial)
field1.at_step(-1) # similar for access of one step
field1.mesh # returns the linked mesh object (see above)
field1.msh # returns a tuple of the mesh (coordinates, connectivity)
field1.coordinates, field1.connectivity # direct access to linked mesh' coords and conn arrays
field1.times # returns timesteps of data
field1.shape # shape of data
field1.dtype # data type of data
```
**Access global data:**
```python
sim.globals
kinetic_energy = sim.globals.kinetic_energy
```
**Open file:**
All methods internally open the HDF5 file and make sure that it is closed again. Sometimes
it's useful to keep the file open (i.e. to directly change something in the file manually).
To do so, you are encouraged to use the following.
> :warning: Do not open the file in write mode (`'w'`) as this truncates the file.
```python
with sim.open(mode='r+') as file:
# do anything
# in here, you can still use all functions of the bamboost, the functions will not close
# the file in the case you manually opened the file...
```
### Job management
You can use `bamboost` to create euler jobs, and to submit them.
```python
from bamboost import Manager
db = Manager(data_path)
params = {...} # dictionary of parameters (can have nested dictionaries)
sim = db.create_simulation(parameters=params)
sim.copy_file('path/to/postprocess.py') # copy a file which is needed to the database folder (e.g. executable, module list, etc.)
sim.copy_file('path/to/cpp_script')
sim.change_note('This run is part of a series in which i investigate the effect of worms on apples')
# commands to execute in batch job
commands = []
commands.append('./cpp_script')
commands.append(f'mpirun python {os.path.join(sim.path, 'postprocess.py')}') # e.g. to write the output to the database from cpp output
sim.create_batch_script(commands, ntasks=4, time=..., mem_per_cpu=..., euler=True)
sim.submit() # submits the job using slurm (works only in jupyterhub sessions on Euler)
```
To be continued...
## Feature requests / Issues
Please open issues on gitlab: [cmbm/bamboost](https://gitlab.ethz.ch/compmechmat/research/libs/bamboost)
Raw data
{
"_id": null,
"home_page": null,
"name": "bamboost",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "hdf5, database, database-manager",
"author": null,
"author_email": "Flavio Lorez <florez@ethz.ch>",
"download_url": "https://files.pythonhosted.org/packages/f9/16/55cea379109e61b5475b3691659ea2b6b8b274d5b801b36fb0758cac0770/bamboost-0.8.2.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n<h3 align=\"center\">\n\t<img src=\"https://gitlab.com/cmbm-ethz/bamboost/-/raw/main/assets/bamboost_icon.png?ref_type=heads\" width=\"150\" alt=\"Logo\"/><br/>\n <br/>\n\tBAMBOOST <br/>\n\n</h3>\n\n<p align=\"center\">\nBamboost is a Python library built for datamanagement using\nthe HDF5 file format.\nbamboost stands for a <span style=\"font-weight: bold;\">lightweight</span> shelf which will <span style=\"font-weight: bold\">boost</span> your efficiency and which\nwill totally break if you load it heavily. Just kidding, bamboo can fully carry pandas. <br/>\n\ud83d\udc3c\ud83d\udc3c\ud83d\udc3c\ud83d\udc3c\n</p>\n\n</div>\n\n\n<div align=\"center\">\n<a href=\"https://bamboost.ch\">\n <img src=\"https://img.shields.io/badge/Docs-bamboost.ch-blue\" alt=\"Website\">\n</a>\n<!-- <a href=\"https://gitlab.com/cmbm-ethz/bamboost/-/commits/main\"> -->\n<!-- <img src=\"https://gitlab.com/cmbm-ethz/bamboost/badges/main/pipeline.svg\" alt=\"pipeline status\"> -->\n<!-- </a> -->\n<!-- <a href=\"https://gitlab.com/cmbm-ethz/bamboost/-/commits/main\"> -->\n<!-- <img src=\"https://gitlab.com/cmbm-ethz/bamboost/badges/main/coverage.svg\" alt=\"coverage report\"> -->\n<!-- </a> -->\n<a href=\"https://badge.fury.io/py/bamboost\">\n <img src=\"https://badge.fury.io/py/bamboost.svg\" alt=\"PyPI version\">\n</a>\n<a href=\"https://pypistats.org/packages/bamboost\">\n <img src=\"https://img.shields.io/pypi/dm/bamboost\" alt=\"PyPI - Downloads\">\n</a>\n<a href=\"https://pypi.org/project/bamboost/\">\n <img src=\"https://img.shields.io/pypi/pyversions/bamboost\" alt=\"PyPI - Python Version\">\n</a>\n<a href=\"https://gitlab.com/cmbm-ethz/bamboost/-/blob/main/LICENSE\">\n <img src=\"https://img.shields.io/pypi/l/bamboost\" alt=\"PyPI - License\">\n</a>\n\n<a href=\"https://gitlab.com/cmbm-ethz/bamboost/-/commits/test-ci\"><img alt=\"pipeline status\" src=\"https://gitlab.com/cmbm-ethz/bamboost/badges/test-ci/pipeline.svg\" /></a> \n<a href=\"https://gitlab.com/cmbm-ethz/bamboost/-/commits/test-ci\"><img alt=\"coverage report\" src=\"https://gitlab.com/cmbm-ethz/bamboost/badges/test-ci/coverage.svg\" /></a>\n\nTerminal user interface for bamboost: https://gitlab.com/zrlf/bamboost-tui.\n\nDocumentation site: https://gitlab.com/zrlf/bamboost-docs.\n</div>\n\n## Installation\nInstall the latest release from the package repository:\n```\npip install bamboost\n```\n\n\nInstall the package in editable mode for more flexibility, $e.g.$ if you plan to make changes yourself:\n```\ngit clone git@gitlab.com:cmbm-ethz/bamboost.git\ncd bamboost\npip install -e .\n```\n> :warning: The option `-e` installs a project in editable mode from a local path. This way,\n> you won't need to reinstall when pulling a new version or changing something in the\n> package.\n\n### MPI support\nFor parallel writing, you need `mpi4py`. Furthermore, the HDF5 library must have\nbeen built with MPI support and the python interface `h5py` must be installed\nwith parallel support (https://docs.h5py.org/en/stable/mpi.html).\n```\nexport CC=mpicc\nexport HDF5_MPI=\"ON\"\npip install --force-reinstall --no-deps --no-binary=h5py h5py\n```\n\n> :warning: If you're system runs into problems installing `mpi4py`, make sure python header files are installed. Quickly google what you need (something like `python3-dev`, `libpython3.8-dev`, etc.). \n\n\n## Requirements\n\n- **Python** >= 3.7 \n- **HDF5** >= 1.10.0\n- **sqlite3** (comes with python) >= 3.0\n\nOptional:\n- **MPICC** or **OpenMPI** for parallel writing\n- **HDF5** with MPI support\n\n\n \n## Usage\n\n### Manager\nThe main object of `bamboost` is the `Manager`. It manages the database located in the directory\nspecified during construction. It can display the parametric space, create new simulations, remove simulations\nselect a specific simulation based on it's `uid` or on conditions of it's parameters.\nEvery database that is created is assigned a unique identifier (UID).\n```python\nfrom bamboost import Manager\n\ndb = Manager('path/to/db')\n```\n\n`pandas.DataFrame` is used to display the database. The dataframe is convenient and fast to filter or sort your entries:\n```python\ndb.df\n```\n\nAn entry (from now on called *simulation*) within a database can be viewed, retrieved and modified with the `Simulation` object.\nTo get the `Simulation` object, access it with it's identifier or location (index) in the dataframe:\n```python\nsim = db['uid']\nsim = db[index]\nsim = db.sim('uid')\n```\n\nAll simulations can be returned as a (sorted) list. The argument `select` can be used to\nfilter the simulations. \n```python\nsims = db.sims() # returns all\nsims = db.sims(select=(db.df.eps==1)) # returns all where eps is 1\nsims = db.sims(sort='parameter1', reverse=False) # returns all, sorrted by parameter1\n```\n:warning: Note that this creates objects for every simulation and the sorting is not optimized. Using pandas to select and sort is much faster. Check their documentation for how to manipulate pandas dataframes.\n\n### Database index\nEvery database created will be assigned a unique identifier (UID). \nThe database path is stored with the UID in an index maintained at `~.config/bamboost` in your home directory. If it is not known, `bamboost` will try to find it on your disk (you can add paths to search in `~.config/bamboost/known_paths.json`).\nYou can obtain a Manager object of any database from anywhere with it's UID. In notebooks, key completion will show you all known databases:\n```python\ndb = Manager.fromUID['UID']\n``` \n\nThe unique id makes refering to data safe. The full identifier of a simulation is considered to be `'(database id):(simulation id)'`. It is encouraged to use the identifiers (instead of the path) to link from one simulation to a different one.\n```python\n# add a link to a different simulation (e.g. the mesh)\nsim.links['mesh_to_use'] = 'DATABASE-ID:simulation-id'\n\n# the full id of a simulation is accessible as such\nuid = sim.get_full_uid()\n```\n\n\n### Write data\nYou can use `bamboost` to write simulation or experimental data.\nUse the `Manager` to create a new simulation (or access an existing one).\nSay you have (or want to create) a database at `data_path`.\nThe code samples below shows the main functionality. \n\n```python\nfrom bamboost import Manager\n\ndb = Manager(data_path)\n\nparams = {...} # dictionary of parameters (can have nested dictionaries)\nwriter = db.create_simulation(parameters=params)\nwriter.copy_file('path/to/file/') # copy a file which is needed to the database folder (e.g. executable, module list, etc.)\nwriter.change_note('This run is part of a series in which i investigate the effect of worms on apples')\n\n# Use context manager (with block) and the file will be tagged 'running', 'finished', 'failed' automatically\nwith writer:\n\n writer.add_metadata() # adds time and other metadata\n writer.add_mesh(coordinates, connectivity) # Add a mesh, default mesh is named 'mesh'. \n writer.add_mesh(coordinates, connectivity, mesh_name='interface') # add a second mesh for e.g. the interface\n \n # loop through your time data and write\n for t in times:\n writer.add_field('field_data_1', array, time=t)\n writer.add_field('field_data_2', array, time=t, mesh='interface')\n writer.add_global_field('kinetic_energy', some_number)\n writer.finish_step() # this increases the step counter\n```\n\nIf you have an existing dataset, $e.g.$ because you created the simulation before and it holds the input parameters or similar. Do the following: You will need to pass the path and the uid to the script (best use `argparse`).\n```python\nfrom bamboost import SimulationWriter\n\nwith SimulationWriter(path, uid) as writer:\n\n # Do anything\n```\n\n#### Userdata (Data not related to time and/or space)\nThe above functionality should be used for ordered data, such as timeseries of spatial data related to a mesh.\nFor anything else, there is the `userdata` category. You can use it to store (almost) anything in the simulation file structured how you would like it. This is also useful to store computed values during postprocessing or plotting.\nInternally, Userdata is an object handling a specific group ('/userdata') of the hdf5 file. To show the content of the group, display the object:\n```python\nsim.userdata\n```\n\n You can create a subgroup, which will return a self-similar object for the new group ($e.g.$ '/userdata/plots'):\n```python\nplot_grp = sim.userdata.require_group('plots')\n```\n\nWriting something to the file (group) is as easy as:\n```python\nsim.userdata['avg_T'] = 34.56256\nsim.userdata['traction_profile'] = np.array([...])\n```\n\nAnd reading:\n```python\n# read avg_T\nsim.userdata['avg_T']\n# read dataset traction_profile\nsim.userdata['traction_profile'] \n# note that this returns an object Dataset. To actually read the array, you will need to slice it\nsim.userdata['traction_profile'][:]\n```\n\n\n### Read data\nThe key purpose is convenient access to data. I recommend an interactive session (notebooks).\n\n#### Display database\n```python\nfrom bamboost import Manager\n\ndb = Manager(data_path)\n```\n\nTo display the database with its parametric space simply input\n```python\ndb.df\n```\nSelect a simulation of your dataset. `sim` will be a `SimulationReader` object.\n```python\nsim = db[index]\nsim = db[uid]\nsims = db.sims((db.df.param1==2) & (db.df.param2>0), sort='param2') # will return list of all matching, sorted by param2\n```\n\n\n**Show data stored:** \nDisplay content of the data, userdata, globals groups:\n```\nsim.data\nsim.userdata\nsim.globals\n```\n\nThis displays the stored fields and its sizes.\n```python\nsim.data.info\n```\n**Access a mesh:** Directly access a tuple where [0] is the coordinates, [1] is the connectivity.\n```python\ncoords, conn = sim.mesh # default mesh\ncoords, conn = sim.get_mesh(mesh_name=...)\n```\nYou can get a mesh object the following way.\n```python\nmesh1 = sim.meshes['mesh1']\nmesh1.coordinates # gives coordinates\nmesh1.connectivity # gives connectivity\nmesh1.get_tuple() # gives both the above\n```\n\n**Access field data**:\n`sim.data` acts as an accessor for all field data.\n```python\nfield1 = sim.data['field1']\nfield1[:], field1[0, :] # slice the dataset and you get numpy arrays (time, *spatial)\nfield1.at_step(-1) # similar for access of one step\nfield1.mesh # returns the linked mesh object (see above)\nfield1.msh # returns a tuple of the mesh (coordinates, connectivity)\nfield1.coordinates, field1.connectivity # direct access to linked mesh' coords and conn arrays\nfield1.times # returns timesteps of data\nfield1.shape # shape of data\nfield1.dtype # data type of data\n```\n\n**Access global data:**\n```python\nsim.globals\nkinetic_energy = sim.globals.kinetic_energy\n```\n\n**Open file:**\nAll methods internally open the HDF5 file and make sure that it is closed again. Sometimes\nit's useful to keep the file open (i.e. to directly change something in the file manually).\nTo do so, you are encouraged to use the following.\n\n> :warning: Do not open the file in write mode (`'w'`) as this truncates the file.\n```python\nwith sim.open(mode='r+') as file:\n # do anything\n # in here, you can still use all functions of the bamboost, the functions will not close\n # the file in the case you manually opened the file...\n```\n\n### Job management\nYou can use `bamboost` to create euler jobs, and to submit them.\n```python\nfrom bamboost import Manager\ndb = Manager(data_path)\nparams = {...} # dictionary of parameters (can have nested dictionaries)\n\nsim = db.create_simulation(parameters=params)\nsim.copy_file('path/to/postprocess.py') # copy a file which is needed to the database folder (e.g. executable, module list, etc.)\nsim.copy_file('path/to/cpp_script')\nsim.change_note('This run is part of a series in which i investigate the effect of worms on apples')\n\n# commands to execute in batch job\ncommands = []\ncommands.append('./cpp_script')\ncommands.append(f'mpirun python {os.path.join(sim.path, 'postprocess.py')}') # e.g. to write the output to the database from cpp output\n\nsim.create_batch_script(commands, ntasks=4, time=..., mem_per_cpu=..., euler=True)\n\nsim.submit() # submits the job using slurm (works only in jupyterhub sessions on Euler)\n```\n\n\nTo be continued...\n\n## Feature requests / Issues\nPlease open issues on gitlab: [cmbm/bamboost](https://gitlab.ethz.ch/compmechmat/research/libs/bamboost)\n",
"bugtrack_url": null,
"license": "Copyright (c) 2023 CMBM, ETH Zurich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A light weight database manager using HDF5",
"version": "0.8.2",
"project_urls": {
"Homepage": "https://bamboost.ch/",
"changelog": "https://gitlab.com/cmbm-ethz/bamboost/-/tree/main/CHANGELOG.md",
"repository": "https://gitlab.com/cmbm-ethz/bamboost"
},
"split_keywords": [
"hdf5",
" database",
" database-manager"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "394f67c3e8075223375140a57b51334cb3f283efcac344888e45f261083003ab",
"md5": "77b99bf7194a3720d58bdeb5ae0de087",
"sha256": "cae6f8b9ebf3dcd13d7a1d7bbfecb08d96cdea983b21e7fc7dca126704da19b5"
},
"downloads": -1,
"filename": "bamboost-0.8.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "77b99bf7194a3720d58bdeb5ae0de087",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 188977,
"upload_time": "2024-11-13T14:32:20",
"upload_time_iso_8601": "2024-11-13T14:32:20.547888Z",
"url": "https://files.pythonhosted.org/packages/39/4f/67c3e8075223375140a57b51334cb3f283efcac344888e45f261083003ab/bamboost-0.8.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f91655cea379109e61b5475b3691659ea2b6b8b274d5b801b36fb0758cac0770",
"md5": "2d88250731a10c8ccf920bd191302e27",
"sha256": "1ccfb1d00aa123e9b10339d30766105b9ae0608e31e21d16b18d525ab31cc74b"
},
"downloads": -1,
"filename": "bamboost-0.8.2.tar.gz",
"has_sig": false,
"md5_digest": "2d88250731a10c8ccf920bd191302e27",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 604097,
"upload_time": "2024-11-13T14:32:22",
"upload_time_iso_8601": "2024-11-13T14:32:22.834586Z",
"url": "https://files.pythonhosted.org/packages/f9/16/55cea379109e61b5475b3691659ea2b6b8b274d5b801b36fb0758cac0770/bamboost-0.8.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 14:32:22",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "cmbm-ethz",
"gitlab_project": "bamboost",
"lcname": "bamboost"
}