DIALS Regression Data Manager
Project description
A python package providing data files used for regression tests in DIALS, dxtbx, xia2 and related packages.
Installation
To install this package in a normal Python environment, run:
install dials_data
To install in a DIALS installation you need to run:
libtbx.pip install dials_data
Usage
Tests that rely on the dials_data package will use it automatically once it is installed. You can also access the regression data using the command line interface:
dials.data
How do I run tests?
Tests using the dials_data package are presumably written using pytest. If they use the fixture provided by dials_data then you can run the tests with:
pytest --regression
How do I use this in my test?
If your test is written in pytest and you use the fixture provided by dials_data then you can use regression datasets in your test by adding the dials_data fixture to your test, ie:
def test_accessing_a_dataset(dials_data): location = dials_data("x4wide")
The fixture/variable dials_data in the test is a dials_data.download.DataFetcher instance, which can be called with the name of the dataset you want to access (here: x4wide). If the files are not present on the machine then they will be downloaded. If either the download fails or --regression is not specified then the test is skipped.
The return value (location) is a py.path.local object pointing to the directory containing the requested dataset.
How do I use this in my Python package?
Assuming you are using pytest then simply add the following to a file named conftest.py in the top level of your project:
import pytest try: from dials_data import * except ImportError: @pytest.fixture def dials_data(): pytest.skip("Test requires python package dials_data")
Where are the regression datasets stored?
In order of evaluation:
If the environment variable DIALS_DATA is set and exists or can be created then use that location
If the file path /dls/science/groups/scisoft/DIALS/dials_data exists and is readable then use this location. This is a shared directory specific to Diamond Light Source
If the environment variable LIBTBX_BUILD is set and the directory dials_data exists or can be created underneath that location then use that.
Use ~/.cache/dials_data if it exists or can be created
Otherwise fail with a RuntimeError
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
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
Hashes for dials_data-0.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfde06a69cf92274fc549aa91a1ae27d6ee0d1c52ba23fb05fa8706b2b9c5663 |
|
MD5 | acad2d9e750b9600c2e160cfad9a8e9c |
|
BLAKE2b-256 | b45b9ceda03eb72b263f8d04bf4b6df12949bb454e4d67f7cb83e39d054d0331 |