Python package to access ISPyB database
Project description
ISPyB API
This package provides a way to write acquisition and processing results into an ISPyB database. Currently, the only supported method is through stored procedures, but the package is designed to allow for other methods as well, such as webservices.
Documentation
Please see https://ispyb.readthedocs.io.
Requirements
- Python 3.10 (minimum), 3.11, 3.12, 3.13 (recommended)
- The MySQL Connector/Python package.
- MariaDB 10.0+ or MySQL 5.6+, but we recommend MariaDB 10.2 or later.
- An ISPyB database installed on the above. See the ispyb-database repository for details.
Installation
From PyPI:
pip install --user ispyb
The --user option installs the package for your own user only.
You can leave it out if you want to install the package system-wide.
To install the source code in editable mode for development:
git clone git@github.com:DiamondLightSource/ispyb-api.git
pip install --user -e ispyb-api
Examples
import ispyb
from datetime import datetime
# Get a connection and data area objects
with ispyb.open("config.cfg") as conn:
core = conn.core
mx_acquisition = conn.mx_acquisition
# Find the id for a given visit
sessionid = core.retrieve_visit_id("cm14451-2")
# Create a new data collection group entry:
params = mx_acquisition.get_data_collection_group_params()
params["parentid"] = sessionid
params["experimenttype"] = "OSC"
params["starttime"] = datetime.strptime("2017-09-21 13:00:00", "%Y-%m-%d %H:%M:%S")
params["endtime"] = datetime.strptime("2017-09-21 13:00:10", "%Y-%m-%d %H:%M:%S")
params["comments"] = "This is a test of data collection group."
dcg_id = mx_acquisition.insert_data_collection_group(list(params.values()))
print("dcg_id: %i" % dcg_id)
See docs/pipeline2ispyb.py for a more detailed example of how to use the package.
Tests
Unit tests (pytests) are run automatically by Azure against a real MariaDB ISPyB database schema. You can also run the tests in your Development environment if you have an ISPyB database.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ispyb-11.1.1.tar.gz.
File metadata
- Download URL: ispyb-11.1.1.tar.gz
- Upload date:
- Size: 92.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4665174c2409ddc946fc8f6f97a3c860e41b7a36a513d62f7590cc503fbd3d8b
|
|
| MD5 |
80504abddf2f8f84d37343460f5ee234
|
|
| BLAKE2b-256 |
e2ba54b18ecd46a7a267c3036b958f1293caa34799449e8edd5ab535ccbc3ef4
|
Provenance
The following attestation bundles were made for ispyb-11.1.1.tar.gz:
Publisher:
test-and-publish.yml on DiamondLightSource/ispyb-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ispyb-11.1.1.tar.gz -
Subject digest:
4665174c2409ddc946fc8f6f97a3c860e41b7a36a513d62f7590cc503fbd3d8b - Sigstore transparency entry: 818741599
- Sigstore integration time:
-
Permalink:
DiamondLightSource/ispyb-api@586246a1ddb09b01eb6e842009eefdc2abecc160 -
Branch / Tag:
refs/tags/v1.11.1 - Owner: https://github.com/DiamondLightSource
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test-and-publish.yml@586246a1ddb09b01eb6e842009eefdc2abecc160 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ispyb-11.1.1-py3-none-any.whl.
File metadata
- Download URL: ispyb-11.1.1-py3-none-any.whl
- Upload date:
- Size: 88.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc1b8379fb1bba6762d4c8f8656392976782606b999d263173353de019100c20
|
|
| MD5 |
1f5561cb84bbf8a9968f603f3a50f64e
|
|
| BLAKE2b-256 |
a037be1418400480fc7145b284f1df5eb4471a76099873d8091a46c9a5cc38eb
|
Provenance
The following attestation bundles were made for ispyb-11.1.1-py3-none-any.whl:
Publisher:
test-and-publish.yml on DiamondLightSource/ispyb-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ispyb-11.1.1-py3-none-any.whl -
Subject digest:
cc1b8379fb1bba6762d4c8f8656392976782606b999d263173353de019100c20 - Sigstore transparency entry: 818741649
- Sigstore integration time:
-
Permalink:
DiamondLightSource/ispyb-api@586246a1ddb09b01eb6e842009eefdc2abecc160 -
Branch / Tag:
refs/tags/v1.11.1 - Owner: https://github.com/DiamondLightSource
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test-and-publish.yml@586246a1ddb09b01eb6e842009eefdc2abecc160 -
Trigger Event:
push
-
Statement type: