Debian Codegraph @

README.md

raw symbols SCIP
1 PyCIFRW Readme
2 --------------
3
4 Introduction
5 ------------
6
7 PyCIFRW provides support for reading and writing CIF (Crystallographic
8 Information Format) files using Python. It was developed at the
9 Australian National Beamline Facility (ANBF), run by the Australian
10 Synchrotron Research Program (ASRP), as part of a larger project to
11 provide CIF input/output capabilities for data collection. It is
12 now (Feb 2025) maintained and developed within the Australian Nuclear Science and
13 Technology Organisation (ANSTO). Outside contributions are very
14 welcome.
15
16 Conformance
17 -----------
18
19 The specifications found in Vol G of the International Tables for
20 Crystallography were used as a reference for CIF 1.0/1.1 syntax.
21 http://dx.doi.org/10.1107/S1600576715021871 was used as the CIF 2.0
22 reference.
23
24 PyCifRW has been tested on the IUCr sample CIF1.1 trip files located at
25 http://www.iucr.org/iucr-top/cif/developers/trip and fails or
26 successfully reads as it is supposed to (note that `ciftest5` contains
27 characters now forbidden in CIFs).
28
29 Supported Platforms
30 -------------------
31
32 PyCIFRW is written entirely in Python, and so should run wherever
33 Python runs. Any failures on Mac, Windows or Linux should be
34 communicated to the author, either through the Github issues
35 tracker (http://github.com/jamesrhester/pycifrw/issues) or email.
36
37 The source code of a C extension module is also included in the
38 distribution.
39
40 Installation
41 ------------
42
43 See file [INSTALLATION](https://github.com/jamesrhester/pycifrw/blob/development/INSTALLATION).
44
45 License
46 ----------
47
48 PyCIFRW is made available using the Python 2.0 license. The full text is [here](https://github.com/jamesrhester/pycifrw/blob/development/LICENSE)
49
50 Use
51 ---
52
53 See the various files in the docs directory for details of the interface.
54 Essentially, CIF files look like python dictionaries, with each
55 entry in the dictionary corresponding to a data block. The blocks
56 themselves are also dictionaries, with each data name being a
57 single entry in the dictionary, so for example,
58 `cf['si_std']['_diffrn_meas_wavelength']` will return the value of
59 `_diffrn_meas_wavelength` in the data block named `si_std` of the Cif file object
60 `cf`.
61
62 Example
63 -------
64
65 To read in a CIF:
66
67 from CifFile import ReadCif
68 cf = ReadCif('jun_01_2.cif')
69
70 to access information in a CIF
71
72 wav = cf['si_std']['_diffrn_meas_wavelength']
73
74 to set a value
75
76 cf['si_std']['_diffrn_meas_wavelength'] = 1.54
77
78
79 Example programs
80 ----------------
81
82 The file 'TestPyCIFRW.py' in the source distribution contains around 180 tests
83 of PyCIFRW functionality and is a good source of examples for using both simple
84 and advanced PyCIFRW interfaces.
85
86 The "Programs" directory in the source distribution contains simple example programs.
87 Of interest are `validate_cif.py` which validates a data file against data dictionaries
88 (execute this file at a terminal prompt without arguments for a help message)
89 and `output_asciidoc.py` which will convert a DDLm dictionary into an
90 asciidoc document that can then be converted to HTML or other presentation
91 formats.