Skip to main content

CIF/STAR 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
currently (Aug 2007) under active development and testing.

Conformance
-----------

The CIF 1.1 working specification was used as a reference, and in most
cases the grammar and character sets specified there were copied
directly.

PyCifRW has been tested on the IUCr sample CIF 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). Attempts to add an overlength
dataname to a CIF file currently resident in memory will result in an error.
Output lines do not exceed 2048 characters.

Supported Platforms
-------------------

PyCIFRW is written entirely in Python. While this makes parsing of large
CIF files rather slow, it will run wherever Python runs. It has been
tested on Linux and Windows XP under Python 2.7.

A compiled extension module is available under Linux and Windows to
accelerate CIF file reading.

Files
-----

PyCiFRW consists of the following files:

Original files:

CifFile.py Defines the CifFile module for Python
CifFile.nw Noweb file from which CifFile.py is obtained
CifFile.html Programming notes for CifFile derived also from
CifFile.nw
StarFile.py Defines the StarFile module on which CifFiles are built
StarFile.nw Noweb file from which StarFile.py is obtained
StarFile.html Programming notes for StarFile.py also derived from StarFile.nw
YappsStarParser.py Cif parser automatically generated by Yapps2
YappsStarParser.g Grammar specifications for input to Yapps2
YappsStarParser.html Programming notes for the grammar
YappsStarParser.nw Literate format grammar notes
Makefile How to derive .html, .py and .g files from .nw files
StarScan.so Compiled Python extension module for Linux
StarScan.pyd Compiled Python extension module for Windows

Files derived from other programs:

yapps3_compiled_rt.py Yapps2 runtime support (modified part of the
Yapps2.1.1 distribution)

Installation
------------

See file INSTALLATION

Use
---

See the text in Programming_Manual.html 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 *
>> cf = CifFile.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


Extra programs
--------------

The "Programs" directory contains program "validate_cif.py" which
validates a data files against data dictionaries. Execute this file
without arguments for a help message.

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-3.6.2.1.tar.gz (440.9 kB view details)

Uploaded Source

Built Distribution

PyCifRW-3.6.2.1-py2.7-linux-i686.egg (142.2 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for PyCifRW-3.6.2.1.tar.gz
Algorithm Hash digest
SHA256 de3ba492726f990ef93992822a63a495d20c3145130336579be18e4cd020928a
MD5 b6b693ad4f414b6a9fe4202af314ddce
BLAKE2b-256 33e17a0d0264c87775d477f7aa54517aa1449e2e5fb7b0acff22f18064d45fe0

See more details on using hashes here.

File details

Details for the file PyCifRW-3.6.2.1-py2.7-linux-i686.egg.

File metadata

File hashes

Hashes for PyCifRW-3.6.2.1-py2.7-linux-i686.egg
Algorithm Hash digest
SHA256 4f336c39022eb923e41c4f569e8b91fb70e1884a20c3469ce9ef2a62e5be5e13
MD5 ac32ad90d7ac2d94b270e865b70cf289
BLAKE2b-256 b5e115a4082223b6128bf5496f61e744a3bb8903aa804ddbc6f7d279ab6bed0c

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