https://github.com/datajoint/datajoint-addons
Addons for datajoint-python
https://github.com/datajoint/datajoint-addons
Last synced: 4 months ago
JSON representation
Addons for datajoint-python
- Host: GitHub
- URL: https://github.com/datajoint/datajoint-addons
- Owner: datajoint
- License: lgpl-3.0
- Created: 2015-11-20T18:08:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-05-24T15:03:15.000Z (about 4 years ago)
- Last Synced: 2025-01-10T16:23:27.875Z (6 months ago)
- Language: Python
- Size: 37.1 KB
- Stars: 0
- Watchers: 11
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# datajoint-addons
A collection of addons and nice-to-haves for datajoint-python
## gitlog
A decorator for datajoint tables. Here is an example how to use it
```python
import datajoint as dj
from djaddon import gitlogschema = dj.schema('mydb',locals())
@schema
@gitlog
class MyRelation(dj.Computed):
definition = """
# example table
->SomeForeignKey
idx : int # some index
---
value : double # some value
"""def _make_tuples(self, key):
...
```The `@gitlog` decorator will add a member class called `GitKey` with tier `dj.Part` to `MyRelation` that stores the sha1, the branch, and whether currently modified files exist for the directory `MyRelation` lives in for each entry computed with `_make_tuples`.
## hdf5
Adds the functions `to_hdf5` and `read_hdf5` to a relation. These functions can save and load the table to and from hdf5 files.
```python
import datajoint as dj
from djaddon import hdf5schema = dj.schema('mydb',locals())
@schema
@hdf5
class MyRelation(dj.Computed):
definition = ...
```