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.7, 3.8, 3.9, 3.10, 3.11
- 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
File details
Details for the file ispyb-10.2.4.tar.gz
.
File metadata
- Download URL: ispyb-10.2.4.tar.gz
- Upload date:
- Size: 76.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c712b387e0d52b1f10f4efb6f83fc27446d8f9dad2f8d9e83f0504a178d08897 |
|
MD5 | c082bb6c440e921d6580deacb54df7f0 |
|
BLAKE2b-256 | 244d86b997af1c6cb980697a908bc57c9c9254ce2fb119ff2088d0c4a6234f23 |
File details
Details for the file ispyb-10.2.4-py3-none-any.whl
.
File metadata
- Download URL: ispyb-10.2.4-py3-none-any.whl
- Upload date:
- Size: 72.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 516f6f9601bc0ad04d66d0f740c6b238a94550cb1a2cfa17452dc1d6dde8ddf6 |
|
MD5 | 4dee22dbb75d6886e932a162abf85e3c |
|
BLAKE2b-256 | cb6ac3fd7dfe2d30cc27454af6e93aefdb8f50a5005268e86f8ad0fe319a7884 |