Skip to main content

Python package to access ISPyB database

Project description

PyPI version Conda Version Development status Python versions

Documentation Status Code style: ruff

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

ispyb-12.0.0.tar.gz (92.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ispyb-12.0.0-py3-none-any.whl (88.4 kB view details)

Uploaded Python 3

File details

Details for the file ispyb-12.0.0.tar.gz.

File metadata

  • Download URL: ispyb-12.0.0.tar.gz
  • Upload date:
  • Size: 92.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ispyb-12.0.0.tar.gz
Algorithm Hash digest
SHA256 64f6e1ef0e0c37d51bd2baa500cb13fe519220192f0e2005582406696e68ea2c
MD5 aedb824e2d45263b52051a66928c3830
BLAKE2b-256 2e94e65074a88e4d597b01bbd6fd81a1a2d37b16554f3a4f551733e86d3488a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ispyb-12.0.0.tar.gz:

Publisher: test-and-publish.yml on DiamondLightSource/ispyb-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ispyb-12.0.0-py3-none-any.whl.

File metadata

  • Download URL: ispyb-12.0.0-py3-none-any.whl
  • Upload date:
  • Size: 88.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ispyb-12.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 635350f6207f5ea8703570d6ff4fab1c6be606d68de4b3654e0e6a9b2af0e39a
MD5 97ad4e7f1140e3e2db8e93eb7d1e035f
BLAKE2b-256 f1232911260debcb6304f3ed8099cae7a82228bade388c4c8ca446354f38db47

See more details on using hashes here.

Provenance

The following attestation bundles were made for ispyb-12.0.0-py3-none-any.whl:

Publisher: test-and-publish.yml on DiamondLightSource/ispyb-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page