\(\renewcommand\AA{\text{Å}}\)
22. GSAS-II Export Modules
Many of the data files written by GSAS-II for use by other software is written using a layer of routines called exporters. Exporters usually require quite simple code, so they can be written quickly to allow GSAS-II to provide output in new data formats. The interface to the exporters is self-configuring, so all supplied exporters are available once the exporter is added to the code base. This allows GSAS-II to be quite flexible in adapting to use many data formats without need for extensive coding.
Exports are implemented by deriving a class from
ExportBaseclass in module
GSASIIfiles.
Export routines commonly access the GUI to determine information on
the contents of the file(s) to be written, but for powder diffraction
and phase data export, a routine named Writer() may be defined. If this is
present, the exporter can be used from: mod:~GSASII.GSASIIscriptable
without GUI access. Note that the arguments for the``Writer()`` method
include a histogram tree name as well as a file name to
be written.
A file containing one or more export routine can be placed
either in the GSASII/exports directory (which requires
modification of the __init__.py and the meson.build files)
or the file can be placed in
the ~/.GSASII/exports directory.
(Note that ~ here is translated to the
user’s home directory; for Windows this is usually taken from the
USERPROFILE setting or a combination of HOMEPATH and HOMEDRIVE,
so this directory will usually have form
C:\\Users\\YourUsername\\.GSASII\\exports.
The next time GSAS-II is started,
the file will be loaded with all the other GSAS-II files and
the new data format will appear in the appropriate exporter menu.
22.1. Writing an Exporter Routine
When writing a exporter routine, one should create a new class derived
from class ~GSASII.GSASIIfiles.ExportBaseclass.
The name of the class is arbitrary, but if more than one class is
placed in file, each class must have a different name. The same name
can be repeated if it is in different files.
As described below, this class will implement
an __init__() and an Exporter() method, and many will supply a
Writer() method, too. The purpose of each of these
routines is described below. The easiest way to craft a new exporter
will be to use the other exporters of the same data type as a model
for where to find the data values that will be written, but the documentation
for the parent class (~GSASII.GSASIIfiles.ExportBaseclass) provides
useful information on support routines that pull information from the
GSAS-II data structures into the exporter.
22.1.1. __init__()
The __init__ method will follow standard boilerplate largely independent
of the data type:
def __init__(self):
super(self.__class__,self).__init__( # fancy way to self-reference
G2frame=G2frame,
formatName = 'Format name for menu',
extension='.extn',
longFormatName = 'Longer more detailed format name for status line'
)
The first line in the __init__ method calls the parent class
__init__ method with the following parameters:
G2frame: a reference to the main GSAS-II GUI window or None when run scripted.
formatName: a string to be used in the menu. Should be short.
extension: a string to be used in the file name. All files produced by the exporter will have this extension.
longFormatName: a longer string to be used to describe the format in help.
In addition, one instance variables must be defined:
self.exporttype = ['phase']
The value for self.exporttype determines the type of export that will be performed
(‘project’, ‘phase’, ‘single’, ‘powder’, ‘image’, ‘map’, ‘sasd’, ‘refd’ or (someday)
‘pdf’) and the menu where the exporter will be placed. Note that
‘project’ exports are those that include all data from a
.gpx file (all phases, histograms, etc.)
Another item is optional.
self.multiple = True
The value specified for self.multiple
determines if only a single phase, data set, etc. can be exported at a
time (when False) or when True, a file can be produced with multiple
histograms, phases, etc.
22.1.2. Exporter()
The class must supply a Exporter method that will write a
file. Depending on the settings for self.exporttype and
self.multiple and the contents of the Data Tree, will dictate
what dialogs will be presented to the user to select what will be
written.
22.1.3. Writer()
For powder and phase exports, if the class supplies a Writer()
module, then the export format
will be available for scripted output (with
GSASIIscriptable). These modules are supplied a histogram name
or a phase name and should not attempt to access the GUI. It is not
required that that this method be supplied, but usually it is not hard to do,
unless information from the user is required.
Note that for phase exports the Writer() should be declared as follows:
def Writer(self,hist,phasenam,mode='w'):
while for histogram exports the Writer() should be declared as follows:
def Writer(self,hist,filename=None,mode='w'):
22.1.3.1. Module G2export_examples: Examples
Code to demonstrate how GSAS-II data export routines are created. The
classes defined here, ExportPhaseText,
ExportSingleText, ExportPowderReflText,
and ExportPowderText each demonstrate a different type
of export. Also see
ExportMapASCII in G2export_map for an example of a map export.
22.1.4. G2export_examples Classes and Routines
Classes in G2export_examples follow:
- class GSASII.exports.G2export_examples.ExportPhaseText(G2frame)[source]
Used to create a text file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_examples.ExportPowderReflText(G2frame)[source]
Used to create a text file of reflections from a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_examples.ExportPowderText(G2frame)[source]
Used to create a text file for a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_examples.ExportSingleText(G2frame)[source]
Used to create a text file with single crystal reflection data skips user rejected & space group extinct reflections
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.4.1. Module G2export_csv: Spreadsheet export
Code to create .csv (comma-separated variable) files for GSAS-II data export to a spreadsheet program, etc. Defines a number of .csv exports:
ExportPhaseCSV: phases
ExportPowderCSV: powder data, includes instrument parameters as well as obs & calc patterns, etc.
ExportMultiPowderCSV: multiple powder datasets in a single spreadsheet
ExportPowderReflCSV: reflections from a powder fit
ExportSASDCSV: small angle data set
ExportREFDCSV: reflectometry data set
ExportSingleCSV: single crystal reflection data
ExportStrainCSV: reflectometry datasets
22.1.5. G2export_csv Classes and Routines
Classes in G2export_csv follow:
- class GSASII.exports.G2export_csv.ExportMultiPowderCSV(G2frame)[source]
Used to create a csv file for a stack of powder data sets suitable for display purposes only; no y-calc or weights are exported only x & y-obs
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportPhaseCSV(G2frame)[source]
Used to create a csv file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportPowderCSV(G2frame)[source]
Used to create a csv file for a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportPowderReflCSV(G2frame)[source]
Used to create a csv file of reflections from a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportREFDCSV(G2frame)[source]
Used to create a csv file for a reflectometry data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportSASDCSV(G2frame)[source]
Used to create a csv file for a small angle data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportSingleCSV(G2frame)[source]
Used to create a csv file with single crystal reflection data
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_csv.ExportStrainCSV(G2frame)[source]
Used to create a csv file with single crystal reflection data
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- GSASII.exports.G2export_csv.WriteList(obj, headerItems)[source]
Write a CSV header
- Parameters:
obj (object) – Exporter object
headerItems (list) – items to write as a header
22.1.5.1. Module G2export_PDB: Macromolecular export
Code to export a phase into the venerated/obsolete (pick one)
ASCII PDB format. Also defines exporter ExportPhaseCartXYZ
which writes atom positions in orthogonal coordinates for a phase.
22.1.6. G2export_PDB Classes and Routines
Classes in G2export_PDB follow:
- class GSASII.exports.G2export_PDB.ExportDrawPhaseCartXYZ(G2frame)[source]
Used to create a Cartesian XYZ file for a phase draw atoms
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_PDB.ExportPhaseCartXYZ(G2frame)[source]
Used to create a basic ORCA6 Cartesian inp file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_PDB.ExportPhasePDB(G2frame)[source]
Used to create a PDB file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.6.1. Module G2export_image: 2D Image data export
Demonstrates how an image is retrieved and written. Uses a SciPy routine to write a PNG format file.
22.1.7. G2export_image Classes and Routines
Classes in G2export_image follow:
- class GSASII.exports.G2export_image.ExportImagePNG(G2frame)[source]
Used to create a PNG file for a GSAS-II image
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.7.1. Module G2export_map: Map export
Code to write Fourier/Charge-Flip atomic density maps out in formats that
can be read by external programs. At present a GSAS format
that is supported by FOX and DrawXTL
(ExportMapASCII) and the CCP4 format that
is used by COOT (ExportMapCCP4) are implemented.
22.1.8. G2export_map Classes and Routines
Classes in G2export_map follow:
- class GSASII.exports.G2export_map.ExportMapASCII(G2frame)[source]
Used to create a text file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_map.ExportMapCCP4(G2frame)[source]
Used to create a text file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.8.1. Module G2export_shelx: Examples
Code to export coordinates in the SHELX .ins format (as best as we can make sense of it).
22.1.9. G2export_shelx Classes and Routines
Classes in G2export_shelx follow:
- class GSASII.exports.G2export_shelx.ExportPhaseShelx(G2frame)[source]
Used to create a SHELX .ins file for a phase
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.9.1. Module G2export_CIF: CIF Exports
This implements a complex set of CIF (Crystallographic Information
Framework) exporters. The base class, ExportCIF, implement a
variety of export capabilities,
where extra parameters for ExportCIF.MasterExporter() determine if a project,
single phase or data set are written. The subclasses of
ExportCIF, as listed below, supply these different parameters
when calling that method.
ExportProjectCIF: writes an entire project in a complete CIF intended for submission as a publication,
ExportPhaseCIF: writes a single phase in CIF
ExportPwdrCIF: writes a one powder diffraction dataset CIF
ExportHKLFCIF: writes a single crystal dataset
22.1.10. G2export_CIF Classes and Routines
Classes in G2export_CIF follow:
- GSASII.exports.G2export_CIF.CIF2dict(cf)[source]
copy the contents of a CIF out from a PyCifRW block object into a dict
- Returns:
cifblk, loopstructure where cifblk is a dict with CIF items and loopstructure is a list of lists that defines which items are in which loops.
- class GSASII.exports.G2export_CIF.CIFdefHelp(parent, msg, helpwin, helptxt)[source]
Create a help button that displays help information on the current data item
- Parameters:
parent – the panel which will be the parent of the button
msg (str) – the help text to be displayed
helpwin (wx.Dialog) – Frame for CIF editing dialog
helptxt (wx.TextCtrl) – TextCtrl where help text is placed
- class GSASII.exports.G2export_CIF.CIFtemplateSelect(frame, panel, tmplate, G2dict, repaint, title, defaultname='', cifKey='CIF_template')[source]
Create a set of buttons to show, select and edit a CIF template
- Parameters:
frame – wx.Frame object of parent
panel – wx.Panel object where widgets should be placed
tmplate (str) – one of ‘publ’, ‘phase’, or ‘instrument’ to determine the type of template
G2dict (dict) – GSAS-II dict where CIF should be placed. The key specified in cifKey (defaults to “CIF_template”) will be used to store either a list or a string. If a list, it will contain a dict and a list defining loops. If an str, it will contain a file name.
repaint (function) – reference to a routine to be called to repaint the frame after a change has been made
title (str) – A line of text to show at the top of the window
defaultname (str) – specifies the default file name to be used for saving the CIF.
cifKey (str) – key to be used for saving the CIF information in G2dict. Defaults to “CIF_template”
- class GSASII.exports.G2export_CIF.EditCIFpanel(parent, cifblk, loopstructure, cifdic={}, OKbuttons=[], **kw)[source]
Creates a scrolled panel for editing CIF template items
- Parameters:
parent (wx.Frame) – parent frame where panel will be placed
cifblk – dict or PyCifRW block containing values for each CIF item
loopstructure (list) –
a list of lists containing the contents of each loop, as an example:
[ ["_a","_b"], ["_c"], ["_d_1","_d_2","_d_3"]]
this describes a CIF with this type of structure:
loop_ _a _b <a1> <b1> <a2> ... loop_ _c <c1> <c2>... loop _d_1 _d_2 _d_3 ...
Note that the values for each looped CIF item, such as _a, are contained in a list, for example as cifblk[“_a”]
cifdic (dict) – optional CIF dictionary definitions
OKbuttons (list) – A list of wx.Button objects that should be disabled when information in the CIF is invalid
(other) – optional keyword parameters for wx.ScrolledPanel
- CIFEntryWidget(dct, item, dataname)[source]
Create an entry widget for a CIF item. Use a validated entry for numb values where int is required when limits are integers and floats otherwise. At present this does not allow entry of the special CIF values of “.” and “?” for numerical values and highlights them as invalid. Use a selection widget when there are specific enumerated values for a string.
- ControlOKButton(setvalue)[source]
Enable or Disable the OK button(s) for the dialog. Note that this is passed into the ValidatedTxtCtrl for use by validators.
- Parameters:
setvalue (bool) – if True, all entries in the dialog are checked for validity. The first invalid control triggers disabling of buttons. If False then the OK button(s) are disabled with no checking of the invalid flag for each control.
- class GSASII.exports.G2export_CIF.EditCIFtemplate(parent, cifblk, loopstructure, defaultname)[source]
Create a dialog for editing a CIF template. The edited information is placed in cifblk. If the CIF is saved as a file, the name of that file is saved as
self.newfile.- Parameters:
parent (wx.Frame) – parent frame or None
cifblk – dict or PyCifRW block containing values for each CIF item
loopstructure (list) –
a list of lists containing the contents of each loop, as an example:
[ ["_a","_b"], ["_c"], ["_d_1","_d_2","_d_3"]]
this describes a CIF with this type of structure:
loop_ _a _b <a1> <b1> <a2> ... loop_ _c <c1> <c2>... loop _d_1 _d_2 _d_3 ...
Note that the values for each looped CIF item, such as _a, are contained in a list, for example as cifblk[“_a”]
defaultname (str) – specifies the default file name to be used for saving the CIF.
- class GSASII.exports.G2export_CIF.ExportCIF(G2frame, formatName, extension, longFormatName=None)[source]
Base class for CIF exports. Not used directly. Exporters are defined in subclasses that call
MasterExporter().- MasterExporter(event=None, phaseOnly=None, histOnly=None)[source]
Basic code to export a CIF. Export can be full or simple, as set by phaseOnly and histOnly which skips distances & angles, etc.
- Parameters:
phaseOnly (bool) – used to export only one phase
histOnly (bool) – used to export only one histogram
- class GSASII.exports.G2export_CIF.ExportHKLCIF(G2frame)[source]
Used to create a simple CIF containing diffraction data only. Uses exact same code as
ExportCIFexcept that histOnly is set for the Exporter Shows up in menu as Quick CIF.- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_CIF.ExportPhaseCIF(G2frame)[source]
Used to create a simple CIF with one phase. Uses exact same code as
ExportCIFexcept that phaseOnly is set for the Exporter Shows up in menu as Quick CIF.also called directly in OnISOSearch in GSASIIphsGUI
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_CIF.ExportProjectCIF(G2frame)[source]
Used to create a CIF of an entire project
also called directly in
ExportSequentialFullCIF()inGSASIImiscGUI- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_CIF.ExportPwdrCIF(G2frame)[source]
Used to create a simple CIF containing diffraction data only. Uses exact same code as
ExportCIFexcept that histOnly is set for the Exporter Shows up in menu as Quick CIF.- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- GSASII.exports.G2export_CIF.FmtAtomType(sym)[source]
Reformat a GSAS-II atom type symbol to match CIF rules
- GSASII.exports.G2export_CIF.HillSortElements(elmlist)[source]
Sort elements in “Hill” order: C, H, others, (where others are alphabetical).
- Params list elmlist:
a list of element strings
- Returns:
a sorted list of element strings
- GSASII.exports.G2export_CIF.LoadCIFdic()[source]
Create a composite core+powder CIF lookup dict containing information about all items in the CIF dictionaries, loading pickled files if possible. The routine looks for files named cif_core.cpickle and cif_pd.cpickle in every directory in the path and if they are not found, files cif_core.dic and/or cif_pd.dic are read.
- Returns:
the dict with the definitions
- GSASII.exports.G2export_CIF.PickleCIFdict(fil)[source]
Loads a CIF dictionary, cherry picks out the items needed by local code and sticks them into a python dict and writes that dict out as a pickle file for later reuse. If the write fails a warning message is printed, but no exception occurs.
- Parameters:
fil (str) – file name of CIF dictionary, will usually end in .dic
- Returns:
the dict with the definitions
- GSASII.exports.G2export_CIF.WriteAtomsMM(fp, phasedict, phasenam, parmDict, sigDict, RBparms={})[source]
Write atom positions to CIF using mmCIF items
- GSASII.exports.G2export_CIF.WriteAtomsMagnetic(fp, phasedict, phasenam, parmDict, sigDict, labellist)[source]
Write atom positions to CIF
- GSASII.exports.G2export_CIF.WriteAtomsNuclear(fp, phasedict, phasenam, parmDict, sigDict, labellist, RBparms={}, RBsuDict={})[source]
Write atom positions to CIF
- GSASII.exports.G2export_CIF.WriteCIFitem(fp, name, value='')[source]
Helper function for writing CIF output. This gets used in different ways. The simplest use will be:
>>> WriteCIFitem(fp, '_some_cif_name', valstr)
For loops it will be used like this:
>>> WriteCIFitem(fp, 'loop_ _cif_name1 _cif_name2') >>> for v1,v2 in values: >>> WriteCIFitem(fp, value=v1) >>> WriteCIFitem(fp, value=v2)
or if items will be aligned in a table (no spaces or new lines in the items)
>>> WriteCIFitem(fp, 'loop_ _cif_name1 _cif_name2') >>> for v1,v2 in values: >>> s = PutInCol("{:.4f}".format(v1),10) >>> s += PutInCol(str(v2),8) >>> WriteCIFitem(fp, value=s)
It is occasionally used where a CIF value is passed as the name parameter. This works if no quoting is needed, but is not a good practice.
- Parameters:
fp – file access object
name (str) – a CIF data name
value (str) – the value associated with the CIF data name. Written in different ways depending on what the contents contain, with respect to quoting.
- GSASII.exports.G2export_CIF.WriteComposition(fp, phasedict, phasenam, parmDict, quickmode=True, keV=None)[source]
determine the composition for the unit cell, crudely determine Z and then compute the composition in formula units.
If quickmode is False, then scattering factors are added to the element loop.
If keV is specified, then resonant scattering factors are also computed and included.
- GSASII.exports.G2export_CIF.WriteCompositionMM(fp, phasedict, phasenam, parmDict, quickmode=True, keV=None)[source]
determine the composition for the unit cell, crudely determine Z and then compute the composition in formula units.
If quickmode is False, then scattering factors are added to the element loop.
If keV is specified, then resonant scattering factors are also computed and included.
- GSASII.exports.G2export_CIF.WriteSeqAtomsNuclear(fp, cell, phasedict, phasenam, hist, seqData, RBparms)[source]
Write atom positions to CIF
- GSASII.exports.G2export_CIF.dict2CIF(dblk, loopstructure, blockname='Template')[source]
Create a PyCifRW CIF object containing a single CIF block object from a dict and loop structure list.
- Parameters:
dblk – a dict containing values for each CIF item
loopstructure (list) –
a list of lists containing the contents of each loop, as an example:
[ ["_a","_b"], ["_c"], ["_d_1","_d_2","_d_3"]]
this describes a CIF with this type of structure:
loop_ _a _b <a1> <b1> <a2> ... loop_ _c <c1> <c2>... loop _d_1 _d_2 _d_3 ...
Note that the values for each looped CIF item, such as _a, are contained in a list, for example as cifblk[“_a”]
blockname (str) – an optional name for the CIF block. Defaults to ‘Template’
- Returns:
the newly created PyCifRW CIF object
- GSASII.exports.G2export_CIF.getCellwStrain(phasedict, seqData, pId, histname)[source]
Get cell parameters and their errors for a sequential fit
- GSASII.exports.G2export_CIF.mkSeqResTable(mode, seqHistList, seqData, Phases, Histograms, Controls)[source]
Setup sequential results table (based on code from
GSASII.GSASIIseqGUI.UpdateSeqResults())TODO: This should be merged with the table build code in
GSASII.GSASIIseqGUI.UpdateSeqResults()and moved to somewhere non-GUI likeGSASIIstrIOto create a single routine that can be used in both places, but this means returning some of the code that has been removed from there.
22.1.10.1. Module G2export_pwdr: Export powder input files
Creates files used by GSAS (FXYE) & TOPAS (XYE) as input
22.1.11. G2export_pwdr Classes and Routines
Classes in G2export_pwdr follow:
- class GSASII.exports.G2export_pwdr.ExportPowderFXYE(G2frame)[source]
Used to create a FXYE file for a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_pwdr.ExportPowderXYE(G2frame)[source]
Used to create a Topas XYE file for a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.11.1. Module G2export_FIT2D: Fit2D “Chi” export
Code to create .chi (Fit2D like) files for GSAS-II powder data export
22.1.12. G2export_FIT2d Classes and Routines
Classes in G2export_FIT2D follow:
- class GSASII.exports.G2export_FIT2D.ExportPowderCHI(G2frame)[source]
Used to create a CHI file for a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
- class GSASII.exports.G2export_FIT2D.ExportPowderQCHI(G2frame)[source]
Used to create a q-binned CHI file for a powder data set
- Parameters:
G2frame (wx.Frame) – reference to main GSAS-II frame
22.1.12.1. Module G2export_JSON: ASCII .gpx Export
This implements a fairly simple exporter, ExportJSON, that can export the
contents of an entire project as a sort-of human readable (JSON) ASCII file.
This provides a way to see the contents of a GSAS-II project
file. This does not provide a mechanism to change the contents of a .gpx file,
since there are no provisions to read this file back into GSAS-II, as
the likelihood of breaking a data structure is too high.
If you want to change the contents of a .gpx file, use GSASIIscriptable
where you can access the native Python data structures and change things,
with a good chance of getting things to work.
22.1.13. G2export_JSON Classes and Routines
Classes in G2export_JSON follow:
This code is to honor my friend Robert Papoular, who wants to see what is inside a .gpx file.
- class GSASII.exports.G2export_JSON.ExportJSON(G2frame)[source]
Implement JSON export of entire projects
- class GSASII.exports.G2export_JSON.JsonEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
This provides the ability to turn np arrays and masked arrays into something that json can handle.
- default(obj)[source]
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o)
22.1.13.1. Module G2export_Bracket: ASCII .gpx Export
This provides to methods for tabulating GSAS-II parameters from a
project for use in manuscript preparation into an ASCII .csv
(spreadsheet) file.
The exporter, Exportbracket, creates a text file with
standard uncertainties for values in crystallographic (e.g. “bracket”)
notation:
i.e.: 1.234(5), which
indicates a value of 1.234 with a standard uncertainty of 0.005. A
second method, Export3col, provides the standard uncertainties
as a separate column.
This module initially written by Conrad Gillard. For any enquiries please contact conrad.gillard@gmail.com.
22.1.14. G2export_Bracket Classes and Routines
Classes in G2export_Bracket follow.