GSAS-II Logo
  • 1. GSASIIscriptable: Scripting Interface
    • 1.1. Summary/Contents
    • 1.2. Installation of GSASIIscriptable
    • 1.3. Accessing the GSASIIscriptable Module
      • 1.3.1. Explicit GSASIIscriptable Specification
      • 1.3.2. Install GSASIIscriptable Location Into Python
      • 1.3.3. When GSAS-II is Installed Inside Python
    • 1.4. Application Interface (API) Summary
      • 1.4.1. Overview of Classes
      • 1.4.2. Independent Functions
      • 1.4.3. Class G2Project
      • 1.4.4. Class G2Phase
      • 1.4.5. Class G2PwdrData
      • 1.4.6. Class G2Single
      • 1.4.7. Class G2Image
      • 1.4.8. Class G2PDF
      • 1.4.9. Class G2SmallAngle
      • 1.4.10. Class G2SeqRefRes
      • 1.4.11. Class G2AtomRecord
    • 1.5. Refinement parameters
      • 1.5.1. Project-level Parameter Dict
      • 1.5.2. Refinement recipe
      • 1.5.3. Refinement parameter types
    • 1.6. Specifying Refinement Parameters
      • 1.6.1. Histogram parameters
      • 1.6.2. Phase parameters
      • 1.6.3. Histogram-and-phase parameters
      • 1.6.4. Histogram/Phase objects
    • 1.7. Access to other parameter settings
    • 1.8. Code Examples
      • 1.8.1. Accessing GSASIIscriptable
      • 1.8.2. Status Information
      • 1.8.3. Peak Fitting
      • 1.8.4. Pattern Simulation
      • 1.8.5. Simple Refinement
      • 1.8.6. Sequential Refinement
      • 1.8.7. Image Processing
      • 1.8.8. Image Calibration
      • 1.8.9. Optimized Image Integration
      • 1.8.10. Multicore Image Integration
      • 1.8.11. Access the Image Pixel-Mask
      • 1.8.12. Histogram Export
      • 1.8.13. Automatic Background
      • 1.8.14. Specify Instrument Parameters Directly
    • 1.9. GSASIIscriptable Command-line Interface
      • 1.9.1. Parameters in JSON files
    • 1.10. API: Complete Documentation
      • G2AtomRecord
        • G2AtomRecord.ADP
        • G2AtomRecord.adp_flag
        • G2AtomRecord.coordinates
        • G2AtomRecord.element
        • G2AtomRecord.label
        • G2AtomRecord.mult
        • G2AtomRecord.occupancy
        • G2AtomRecord.ranId
        • G2AtomRecord.refinement_flags
        • G2AtomRecord.type
        • G2AtomRecord.uiso
      • G2Image
        • G2Image.ControlList
        • G2Image.GeneratePixelMask()
        • G2Image.IntMaskMap()
        • G2Image.IntThetaAzMap()
        • G2Image.Integrate()
        • G2Image.MaskFrameMask()
        • G2Image.MaskThetaMap()
        • G2Image.Recalibrate()
        • G2Image.TestFastPixelMask()
        • G2Image.clearImageCache()
        • G2Image.clearPixelMask()
        • G2Image.findControl()
        • G2Image.getControl()
        • G2Image.getControls()
        • G2Image.getImage()
        • G2Image.getMasks()
        • G2Image.getVary()
        • G2Image.initMasks()
        • G2Image.loadControls()
        • G2Image.loadMasks()
        • G2Image.loadPixelMask()
        • G2Image.saveControls()
        • G2Image.setCalibrant()
        • G2Image.setControl()
        • G2Image.setControlFile()
        • G2Image.setControls()
        • G2Image.setMasks()
        • G2Image.setVary()
      • G2ImportException
      • G2ObjectWrapper
      • G2PDF
        • G2PDF.calculate()
        • G2PDF.export()
        • G2PDF.optimize()
        • G2PDF.set_background()
        • G2PDF.set_formula()
      • G2Phase
        • G2Phase.HAPvalue()
        • G2Phase.InitDisAgl()
        • G2Phase.Origin1to2Shift()
        • G2Phase.ShortDistances()
        • G2Phase.addDistRestraint()
        • G2Phase.add_atom()
        • G2Phase.atom()
        • G2Phase.atoms()
        • G2Phase.clearDistRestraint()
        • G2Phase.clear_HAP_refinements()
        • G2Phase.clear_refinements()
        • G2Phase.composition
        • G2Phase.copyHAPvalues()
        • G2Phase.density
        • G2Phase.export_CIF()
        • G2Phase.getHAPentryList()
        • G2Phase.getHAPentryValue()
        • G2Phase.getHAPvalues()
        • G2Phase.getPhaseEntryList()
        • G2Phase.getPhaseEntryValue()
        • G2Phase.get_cell()
        • G2Phase.get_cell_and_esd()
        • G2Phase.histograms()
        • G2Phase.mu()
        • G2Phase.setDistRestraintWeight()
        • G2Phase.setHAPentryValue()
        • G2Phase.setHAPvalues()
        • G2Phase.setPhaseEntryValue()
        • G2Phase.setSampleProfile()
        • G2Phase.set_HAP_refinements()
        • G2Phase.set_refinements()
      • G2Project
        • G2Project.ComputeWorstFit()
        • G2Project.SAS()
        • G2Project.SASs()
        • G2Project.add_EqnConstr()
        • G2Project.add_EquivConstr()
        • G2Project.add_HoldConstr()
        • G2Project.add_NewVarConstr()
        • G2Project.add_PDF()
        • G2Project.add_SmallAngle()
        • G2Project.add_constraint_raw()
        • G2Project.add_image()
        • G2Project.add_phase()
        • G2Project.add_powder_histogram()
        • G2Project.add_simulated_powder_histogram()
        • G2Project.add_single_histogram()
        • G2Project.clone_powder_histogram()
        • G2Project.copyHistParms()
        • G2Project.copy_PDF()
        • G2Project.do_refinements()
        • G2Project.from_dict_and_names()
        • G2Project.get_Constraints()
        • G2Project.get_Controls()
        • G2Project.get_Covariance()
        • G2Project.get_Frozen()
        • G2Project.get_ParmList()
        • G2Project.get_Variable()
        • G2Project.get_VaryList()
        • G2Project.histType()
        • G2Project.histogram()
        • G2Project.histograms()
        • G2Project.hold_many()
        • G2Project.image()
        • G2Project.imageMultiDistCalib()
        • G2Project.images()
        • G2Project.iter_refinements()
        • G2Project.link_histogram_phase()
        • G2Project.make_var_obj()
        • G2Project.pdf()
        • G2Project.pdfs()
        • G2Project.phase()
        • G2Project.phases()
        • G2Project.refine()
        • G2Project.reload()
        • G2Project.save()
        • G2Project.seqref()
        • G2Project.set_Controls()
        • G2Project.set_Frozen()
        • G2Project.set_refinement()
        • G2Project.update_ids()
      • G2PwdrData
        • G2PwdrData.Background
        • G2PwdrData.ComputeMassFracs()
        • G2PwdrData.EditSimulated()
        • G2PwdrData.Excluded()
        • G2PwdrData.Export()
        • G2PwdrData.Export_peaks()
        • G2PwdrData.InstrumentParameters
        • G2PwdrData.Limits()
        • G2PwdrData.LoadProfile()
        • G2PwdrData.PeakList
        • G2PwdrData.Peaks
        • G2PwdrData.SampleParameters
        • G2PwdrData.SaveProfile()
        • G2PwdrData.add_back_peak()
        • G2PwdrData.add_peak()
        • G2PwdrData.calc_autobkg()
        • G2PwdrData.clear_refinements()
        • G2PwdrData.del_back_peak()
        • G2PwdrData.fit_fixed_points()
        • G2PwdrData.getHistEntryList()
        • G2PwdrData.getHistEntryValue()
        • G2PwdrData.get_wR()
        • G2PwdrData.getdata()
        • G2PwdrData.ref_back_peak()
        • G2PwdrData.refine_peaks()
        • G2PwdrData.reflections()
        • G2PwdrData.residuals
        • G2PwdrData.setHistEntryValue()
        • G2PwdrData.set_background()
        • G2PwdrData.set_peakFlags()
        • G2PwdrData.set_refinements()
        • G2PwdrData.y_calc()
      • G2ScriptException
      • G2SeqRefRes
        • G2SeqRefRes.RefData()
        • G2SeqRefRes.get_Covariance()
        • G2SeqRefRes.get_ParmList()
        • G2SeqRefRes.get_Variable()
        • G2SeqRefRes.get_VaryList()
        • G2SeqRefRes.get_cell_and_esd()
        • G2SeqRefRes.histograms()
      • G2Single
        • G2Single.Export()
        • G2Single.clear_refinements()
        • G2Single.set_refinements()
      • G2SmallAngle
      • GenerateReflections()
      • IPyBrowse()
      • LoadDictFromProjFile()
      • LoadG2fil()
      • PreSetup()
      • Readers
      • SaveDictToProjFile()
      • SetDebugMode()
      • SetPrintLevel()
      • SetupGeneral()
      • ShowVersions()
      • add()
      • blkSize
      • calcMaskMap()
      • calcThetaAzimMap()
      • create()
      • dictDive()
      • downloadFile()
      • dump()
      • export()
      • exportersByExtension
      • import_generic()
      • installScriptingShortcut()
      • load_iprms()
      • load_pwd_from_reader()
      • main()
      • make_empty_project()
      • refine()
  • 2. GSASII Data object & variable organization
    • 2.1. Summary/Contents
    • 2.2. Parameter names in GSAS-II
    • 2.3. GSAS-II Data Tree
      • 2.3.1. Constraints Tree Item
      • 2.3.2. Covariance Tree Item
      • 2.3.3. Phase Tree Items
      • 2.3.4. Rigid Body Objects
      • 2.3.5. Space Group Objects
      • 2.3.6. Phase Information
        • 2.3.6.1. Atom Records
        • 2.3.6.2. Drawing Atom Records
        • 2.3.6.3. Rigid Body Insertions
      • 2.3.7. Powder Diffraction Tree Items
        • 2.3.7.1. CW Instrument Parameters
        • 2.3.7.2. TOF Instrument Parameters
      • 2.3.8. Powder Reflection Data Structure
      • 2.3.9. Single Crystal Tree Items
      • 2.3.10. Single Crystal Reflection Data Structure
      • 2.3.11. Image Data Structure
      • 2.3.12. Controls used for Distance/Angle computation
    • 2.4. Parameter Dictionary
    • 2.5. Texture implementation
    • 2.6. ISODISTORT implementation
      • 2.6.1. Displacive modes
      • 2.6.2. Occupancy modes
      • 2.6.3. Mode Computations
    • 2.7. Parameter Limits
  • 3. GSASIIobj: Data objects & Docs
    • 3.1. GSASIIobj Classes and routines
      • AddPhase2Index()
      • AtomIdLookup
      • AtomRanIdLookup
      • CompileVarDesc()
      • CreatePDFitems()
      • DefaultControls
      • ExpressionCalcObj
        • ExpressionCalcObj.EvalExpression()
        • ExpressionCalcObj.SetupCalc()
        • ExpressionCalcObj.UpdateDict()
        • ExpressionCalcObj.UpdateVars()
        • ExpressionCalcObj.__init__()
        • ExpressionCalcObj.__weakref__
        • ExpressionCalcObj.compiledExpr
        • ExpressionCalcObj.eObj
        • ExpressionCalcObj.exprDict
        • ExpressionCalcObj.fxnpkgdict
        • ExpressionCalcObj.lblLookup
        • ExpressionCalcObj.parmDict
        • ExpressionCalcObj.su
        • ExpressionCalcObj.varLookup
      • ExpressionObj
        • ExpressionObj.CheckVars()
        • ExpressionObj.EditExpression()
        • ExpressionObj.GetDepVar()
        • ExpressionObj.GetIndependentVars()
        • ExpressionObj.GetVaried()
        • ExpressionObj.GetVariedVarVal()
        • ExpressionObj.LoadExpression()
        • ExpressionObj.ParseExpression()
        • ExpressionObj.SetDepVar()
        • ExpressionObj.UpdateVariedVars()
        • ExpressionObj.__init__()
        • ExpressionObj.__weakref__
        • ExpressionObj.assgnVars
        • ExpressionObj.expression
        • ExpressionObj.freeVars
        • ExpressionObj.lastError
      • FindFunction()
      • G2Exception
        • G2Exception.__init__()
        • G2Exception.__str__()
        • G2Exception.__weakref__
      • G2RefineCancel
        • G2RefineCancel.__init__()
        • G2RefineCancel.__str__()
        • G2RefineCancel.__weakref__
      • G2VarObj
        • G2VarObj.__eq__()
        • G2VarObj.__hash__()
        • G2VarObj.__init__()
        • G2VarObj.__repr__()
        • G2VarObj.__str__()
        • G2VarObj.__weakref__
        • G2VarObj._show()
        • G2VarObj.fmtVarByMode()
        • G2VarObj.varname()
      • GenWildCard()
      • GetPhaseNames()
      • HistIdLookup
      • HistRanIdLookup
      • HowDidIgetHere()
      • ImportBaseclass
        • ImportBaseclass.CIFValidator()
        • ImportBaseclass.ContentsValidator()
        • ImportBaseclass.ExtensionValidator()
        • ImportBaseclass.ImportException
        • ImportBaseclass.ReInitialize()
        • ImportBaseclass.__init__()
        • ImportBaseclass.__weakref__
      • ImportImage
        • ImportImage.InitParameters()
        • ImportImage.LoadImage()
        • ImportImage.ReInitialize()
        • ImportImage.__init__()
      • ImportPDFData
        • ImportPDFData.ReInitialize()
        • ImportPDFData.__init__()
      • ImportPhase
        • ImportPhase.__init__()
      • ImportPowderData
        • ImportPowderData.ReInitialize()
        • ImportPowderData.__init__()
      • ImportReflectometryData
        • ImportReflectometryData.ReInitialize()
        • ImportReflectometryData.__init__()
      • ImportSmallAngleData
        • ImportSmallAngleData.ReInitialize()
        • ImportSmallAngleData.__init__()
      • ImportStructFactor
        • ImportStructFactor.Banks
        • ImportStructFactor.InitParameters()
        • ImportStructFactor.Parameters
        • ImportStructFactor.ReInitialize()
        • ImportStructFactor.UpdateParameters()
        • ImportStructFactor.__init__()
      • IndexAllIds()
      • LookupAtomId()
      • LookupAtomLabel()
      • LookupHistId()
      • LookupHistName()
      • LookupPhaseId()
      • LookupPhaseName()
      • LookupWildCard()
      • MakeUniqueLabel()
      • PhaseIdLookup
      • PhaseRanIdLookup
      • ReadCIF()
      • SetDefaultSample()
      • SetNewPhase()
      • ShortHistNames
      • ShortPhaseNames
      • ShowTiming
        • ShowTiming.__init__()
        • ShowTiming.__weakref__
      • SortVariables()
      • StripUnicode()
      • TestIndexAll()
      • VarDescr()
      • _lookup()
      • fmtVarDescr()
      • getDescr()
      • getVarDescr()
      • getVarStep()
      • patchControls()
      • prmLookup()
      • reVarDesc
      • reVarStep
      • removeNonRefined()
      • restraintNames
      • validateAtomDrawType()
  • 4. GSAS-II Execution Environment
    • 4.1. Supported Platforms
    • 4.2. Source Code Management
    • 4.3. Python Requirements
      • 4.3.1. GUI Requirements
      • 4.3.2. Recommended Packages for GUI Use
      • 4.3.3. Scripting Requirements
      • 4.3.4. Recommended Packages for Scripting
      • 4.3.5. Optional Python Packages
      • 4.3.6. Compilation Requirements
      • 4.3.7. Installation Notes for Minimal Python configuration
    • 4.4. Required Binary Files
    • 4.5. Supported Externally-Developed Software
  • 5. Indices
    • 5.1. General Index
  • References to the GSAS-II Developer’s Documentation
  • References to the GSAS-II Developer’s Documentation
GSAS-II
  • GSAS-II Scripting Manual
  • View page source

\(\renewcommand\AA{\text{Å}}\)

GSAS-II Scripting Manual

This is a subset of the Developer’s Documentation covering the GSASIIscriptable package, used to create Python scripts for running GSAS-II. Note that most data structures used in GSAS-II are defined in module GSASIIobj, also included here.

Documentation Version:

This documentation was prepared from GSAS-II version 055adb dated 03-Jun-2026 14:05 with the most recent tag as version #5834

Contents:

  • 1. GSASIIscriptable: Scripting Interface
    • 1.1. Summary/Contents
    • 1.2. Installation of GSASIIscriptable
    • 1.3. Accessing the GSASIIscriptable Module
    • 1.4. Application Interface (API) Summary
    • 1.5. Refinement parameters
    • 1.6. Specifying Refinement Parameters
    • 1.7. Access to other parameter settings
    • 1.8. Code Examples
    • 1.9. GSASIIscriptable Command-line Interface
    • 1.10. API: Complete Documentation
  • 2. GSASII Data object & variable organization
    • 2.1. Summary/Contents
    • 2.2. Parameter names in GSAS-II
    • 2.3. GSAS-II Data Tree
    • 2.4. Parameter Dictionary
    • 2.5. Texture implementation
    • 2.6. ISODISTORT implementation
    • 2.7. Parameter Limits
  • 3. GSASIIobj: Data objects & Docs
    • 3.1. GSASIIobj Classes and routines
  • 4. GSAS-II Execution Environment
    • 4.1. Supported Platforms
    • 4.2. Source Code Management
    • 4.3. Python Requirements
    • 4.4. Required Binary Files
    • 4.5. Supported Externally-Developed Software
  • 5. Indices
    • 5.1. General Index
Next

© Copyright 2013-2024, R. B. Von Dreele and B. H. Toby for Argonne National Laboratory.

Built with Sphinx using a theme provided by Read the Docs.