GithubHelp home page GithubHelp logo

tschoonj / ispyb-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from diamondlightsource/ispyb-api

0.0 2.0 0.0 1.13 MB

Package for writing acquisition and processing results into an ISPyB database

License: Apache License 2.0

Python 100.00%

ispyb-api's Introduction

PyPI version Conda Version Development status Python versions

Build Status Coverage Status Documentation Status Code style: black Language grade: Python Total alerts

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 2.7, 3.4, 3.5, 3.6, 3.7
  • 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 repo 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 [email protected]:DiamondLightSource/ispyb-api.git
pip install -e --user 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 Travis against a real MariaDB ISPyB database schema. You can also run the tests in your Development environment if you have an ISPyB database.

ispyb-api's People

Contributors

anthchirp avatar demeter9 avatar graeme-winter avatar karllevik avatar kevinpetersavage avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.