While this book will concentrate on use of GSAS-II with powder diffraction data, the program can be used with many types of diffraction data. Of course, to use that data, it must be read into the program, which is done with a special layer of code and the process of reading in data is called importing and will be discussed here. The special layer of code that is used for importing data has been designed to simplify expansion to include different data formats. Likewise, it is equally important to be able to bring data and results from GSAS-II into other software. That process is called exporting and GSAS-II is also designed for simple expansion of the export software layer to include new formats as well. This will also be discussed in this chapter. There is one format for both imports and exports that deserves special attention and that is the CIF format, which has become the lingua franca of crystallography. Due to the centrality of CIF in crystallography, Chapter 22 presents use of that format in detail.
The magic behind the special layer of software used for importing and exporting of data is that GSAS-II is self-configuring. Each supported family of import and export formats has a (usually small) Python module that either reads or writes the appropriate type of file. These modules are known as importers and exporters. When GSAS-II starts, it will read in the Python files in the GSASII/imports and GSASII/exports directory, as well as a possible user-defined directory for locally defined formats (\(\sim \)/.GSASII/imports and \(\sim \)/.GSASII/exports). To introduce a new format, one simply needs to write a new importer and either add that to an existing file with importers or exporters, or create a new file.1 GSAS-II will include all defined importers and exporters found when the program starts into the appropriate GUI menus and will also make them available for scripting. No additional GUI coding is needed. The GSAS-II Programmer’s documentation includes a chapter on importers (https://gsas-ii.readthedocs.io/en/latest/imports.html) that describes how to create a new importer. The existing importers serve as coding examples for how this is done. Most are quite simple (50-150 lines of code). Likewise, another Programmer’s documentation chapter (https://gsas-ii.readthedocs.io/en/latest/exports.html) documents exporters and discusses how to create a new exporter.