Skip to main content

CIF file support for Python

Project description

PyCIFRW Readme

Introduction

PyCIFRW provides support for reading and writing CIF (Crystallographic Information Format) files using Python. It was developed at the Australian National Beamline Facility (ANBF), run by the Australian Synchrotron Research Program (ASRP), as part of a larger project to provide CIF input/output capabilities for data collection. It is now (Mar 2017) maintained and developed within the Australian Nuclear Science and Technology Organisation (ANSTO).

Conformance

The specifications found in Vol G of the International Tables for Crystallography were used as a reference for CIF 1.0/1.1 syntax. http://dx.doi.org/10.1107/S1600576715021871 was used as the CIF 2.0 reference.

PyCifRW has been tested on the IUCr sample CIF1.1 trip files located at http://www.iucr.org/iucr-top/cif/developers/trip and fails or successfully reads as it is supposed to (note that ciftest5 contains characters now forbidden in CIFs).

Supported Platforms

PyCIFRW is written entirely in Python, and so should run wherever Python runs. Any failures on Mac, Windows or Linux should be communicated to the author, either through the BitBucket issues tracker or email.

The source code of a C extension module is also included in the distribution. This module accelerates CIF file reading. From time to time system-dependent installation packages are generated containing precompiled versions of this module.

Installation

See file [INSTALLATION](https://bitbucket.org/jamesrhester/pycifrw/src/efd90c5e6dec7caf1e61fac68492a7fd66661d97/INSTALLATION?at=development).

License

PyCIFRW is made available using the Python 2.0 license. The full text is [here](https://bitbucket.org/jamesrhester/pycifrw/src/efd90c5e6dec7caf1e61fac68492a7fd66661d97/LICENSE?at=development)

Use

See the various files in the docs directory for details of the interface. Essentially, CIF files look like python dictionaries, with each entry in the dictionary corresponding to a data block. The blocks themselves are also dictionaries, with each data name being a single entry in the dictionary, so for example, cf[‘si_std’][‘_diffrn_meas_wavelength’] will return the value of _diffrn_meas_wavelength in the data block named si_std of the Cif file object cf.

Example

To read in a CIF:

from CifFile import ReadCif cf = ReadCif(‘jun_01_2.cif’)

to access information in a CIF

wav = cf[‘si_std’][‘_diffrn_meas_wavelength’]

to set a value

cf[‘si_std’][‘_diffrn_meas_wavelength’] = 1.54

Example programs

The file ‘TestPyCIFRW.py’ in the source distribution contains around 170 tests of PyCIFRW functionality and is a good source of examples for using both simple and advanced PyCIFRW interfaces.

The “Programs” directory in the source distribution contains simple example programs. Of interest are validate_cif.py which validates a data files against data dictionaries (execute this file at a terminal prompt without arguments for a help message) and output_asciidoc.py which will convert a DDLm dictionary into an asciidoc document that can then be converted to HTML or other presentation formats.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyCifRW-4.3.tar.gz (810.4 kB view details)

Uploaded Source

Built Distributions

PyCifRW-4.3-py3.5-linux-x86_64.egg (316.5 kB view details)

Uploaded Egg

PyCifRW-4.3-py2.7-linux-x86_64.egg (309.3 kB view details)

Uploaded Egg

File details

Details for the file PyCifRW-4.3.tar.gz.

File metadata

  • Download URL: PyCifRW-4.3.tar.gz
  • Upload date:
  • Size: 810.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyCifRW-4.3.tar.gz
Algorithm Hash digest
SHA256 3b19e80278b40ebe00ad49a7dd8813007fbdc7a9a43fd3377e404ac0bcbcd3c3
MD5 943e38845dd21a10af5da0da8886e6e5
BLAKE2b-256 e6724f0b57dfc09c76a4ed93ccc96159b65fd6acd3becd2663aef0ec64e58c1a

See more details on using hashes here.

File details

Details for the file PyCifRW-4.3-py3.5-linux-x86_64.egg.

File metadata

File hashes

Hashes for PyCifRW-4.3-py3.5-linux-x86_64.egg
Algorithm Hash digest
SHA256 a5e8673d0e5bc03466ce97178c141e8bf0a02654f08082163b3c8e3af1e57fd9
MD5 9fe1f332d6f38d3c52234405bbd21024
BLAKE2b-256 51ebde2512053d130d517048ad45af2e459c0238a56f0c9702496c7cde72e826

See more details on using hashes here.

File details

Details for the file PyCifRW-4.3-py2.7-linux-x86_64.egg.

File metadata

File hashes

Hashes for PyCifRW-4.3-py2.7-linux-x86_64.egg
Algorithm Hash digest
SHA256 aa0d524a2c7e4c1a60e66ee269bc814d85e9765c40ac8d0ef55b9508036f4555
MD5 a3336226692aa4d9aa2092e8e39e4050
BLAKE2b-256 bfdb9d3425c596ef60e0a46981e46987e8fa1cf4ee0119d0cd5a33ad738558b1

See more details on using hashes here.

Supported by

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