@@ -3458,13 +3458,21 @@ def residuals(self):
34583458 def InstrumentParameters (self ):
34593459 '''Provides a dictionary with with the Instrument Parameters
34603460 for this histogram.
3461+
3462+ Note that the returned dict is a reference to the actual dict
3463+ as stored in the .gpx file; use care not to modify this unless
3464+ intended.
34613465 '''
34623466 return self .data ['Instrument Parameters' ][0 ]
34633467
34643468 @property
34653469 def SampleParameters (self ):
34663470 '''Provides a dictionary with with the Sample Parameters
34673471 for this histogram.
3472+
3473+ Note that the returned dict is a reference to the actual dict
3474+ as stored in the .gpx file; use care not to modify this unless
3475+ intended.
34683476 '''
34693477 return self .data ['Sample Parameters' ]
34703478
@@ -3473,6 +3481,10 @@ def Background(self):
34733481 '''Provides a list with with the Background parameters
34743482 for this histogram.
34753483
3484+ Note that the returned list is a reference to the actual list
3485+ as stored in the .gpx file; use care not to modify this unless
3486+ intended.
3487+
34763488 :returns: list containing a list and dict with background values
34773489 '''
34783490 return self .data ['Background' ]
@@ -3721,12 +3733,22 @@ def SetInstParms(Inst):
37213733 self .proj .save ()
37223734
37233735 def getdata (self ,datatype ):
3724- '''Provides access to the histogram data of the selected data type
3736+ '''Provides access to the histogram data of the selected data type.
3737+
3738+ It should be noted that for TOF data, GSAS-II expects input
3739+ where the TOF value is the minimum for the bin, but does computations
3740+ using the TOF value for the center of each bin. The values reported
3741+ using the 'X' option here are the values used in computation, while
3742+ the 'X-orig' option reverses the shift applied when TOF values
3743+ are read in.
37253744
37263745 :param str datatype: must be one of the following values
37273746 (case is ignored):
37283747
37293748 * 'X': the 2theta or TOF values for the pattern
3749+ * 'X-orig': for TOF, time values for the pattern shifted
3750+ as used as input for GSAS-II. For everything else, the values are
3751+ the same as with the 'X' option (see above.)
37303752 * 'Q': the 2theta or TOF values for the pattern transformed to Q
37313753 * 'd': the 2theta or TOF values for the pattern transformed to d-space
37323754 * 'Yobs': the observed intensity values
@@ -3735,24 +3757,36 @@ def getdata(self,datatype):
37353757 * 'Background': the computed background values
37363758 * 'Residual': the difference between Yobs and Ycalc (obs-calc)
37373759
3738- :returns: an numpy MaskedArray with data values of the requested type
3739-
3760+ :returns: a numpy MaskedArray with data values of the requested type.
3761+ Note that the returned values are a copy of the GSAS-II histogram
3762+ array, not a reference to the actual data as stored in the
3763+ .gpx file.
37403764 '''
3741- enums = ['x' , 'yobs' , 'yweight' , 'ycalc' , 'background' , 'residual' , 'q' , 'd' ]
3765+ enums = ['x' , 'yobs' , 'yweight' , 'ycalc' , 'background' , 'residual' , 'q' , 'd' , 'x-orig' ]
37423766 if datatype .lower () not in enums :
37433767 raise G2ScriptException ("Invalid datatype = " + datatype + " must be one of " + str (enums ))
3744- if datatype .lower () == 'q' :
3768+ if datatype .lower () == 'x-orig' :
3769+ x = self .data ['data' ][1 ][0 ]
3770+ if 'T' in self .InstrumentParameters ['Type' ][1 ]:
3771+ xdiff = np .append (np .diff (x ),x [- 1 ]- x [- 2 ]) # make same length as X by duplicating last element
3772+ return x - (xdiff / 2 ) # adjust for midpoint shift on data read
3773+ else :
3774+ return copy .deepcopy (x )
3775+ elif datatype .lower () == 'q' :
37453776 Inst ,Inst2 = self .data ['Instrument Parameters' ]
37463777 return 2 * np .pi / G2lat .Pos2dsp (Inst ,self .data ['data' ][1 ][0 ])
37473778 elif datatype .lower () == 'd' :
37483779 Inst ,Inst2 = self .data ['Instrument Parameters' ]
37493780 return G2lat .Pos2dsp (Inst ,self .data ['data' ][1 ][0 ])
37503781 else :
3751- return self .data ['data' ][1 ][enums .index (datatype .lower ())]
3782+ return copy . deepcopy ( self .data ['data' ][1 ][enums .index (datatype .lower ())])
37523783
37533784 def y_calc (self ):
37543785 '''Returns the calculated intensity values; better to
3755- use :meth:`getdata`
3786+ use :meth:`getdata`.
3787+
3788+ Note that the returned array is a reference to the actual data
3789+ as stored in the .gpx file; use care not to modify this.
37563790 '''
37573791 return self .data ['data' ][1 ][3 ]
37583792
@@ -3764,6 +3798,9 @@ def reflections(self):
37643798 'Type' (histogram type), 'FF'
37653799 (form factor information), 'Super' (True if this is superspace
37663800 group).
3801+
3802+ Note that the returned array is a reference to the actual data
3803+ as stored in the .gpx file; use care not to modify this.
37673804 '''
37683805 return self .data ['Reflection Lists' ]
37693806
0 commit comments