[GSAS-II] BUG / misleading error message in set_HAP_refinements()

Ivo Alxneit ivo.alxneit at psi.ch
Wed May 29 02:51:40 CDT 2019


Dear all

I need to copy some HAP parameters from src to dest. I use the following
code


# copy HAP data from first histogram in src
src_phase=src.phase(phase_name)
sh = src_phase.histograms()[0]
src_HAP = src_phase.getHAPvalues(sh)

# only copy `HStrain` and `Size`
toCopy = ['Size', 'HStrain']
delete = [key for key in src_HAP if key not in toCopy]
for key in delete:
    del src_HAP[key]

# verify that structure of `HStrain` and `Size`
# are identical in `src` and `dest`
dest_phase=dest.phase(phase_name)
dh = dest_phase.histograms()[0]
dest_HAP = dest_phase.getHAPvalues(dh)

print('src:\n\t{}\n\t{}'.format(len(src_HAP['HStrain'][1]),
src_HAP['HStrain']))
print('dest:\n\t{}\n\t{}'.format(len(dest_HAP['HStrain'][1]),
dest_HAP['HStrain']))

# copy to all histograms in `dest
dest.phase(phase_name).set_HAP_refinements(src_HAP, histograms='all')




With phase_name='LaSrCoO3' all works fine and the output is

src:
        2
        [[1.3779168060893357e-05, -3.221285027058767e-06], [True, False]]
dest:
        2
        [[4.594163335399874e-07, -3.221285027058767e-06], [True, True]]





With the second phase (phase_name='CuO') things break (and the error
message is wrong. I do provide 4 HStrain terms)

src:
        4
        [[-0.0002725915651569477, 2.2346822830174655e-05,
-0.0002190839818762746, -0.000775794521652514], [True, True, True, True]]
dest:
        4
        [[0.0, 0.0, 0.0, 0.0], [False, False, False, False]]
Traceback (most recent call last):

  File "<ipython-input-66-5a8a88cebe20>", line 23, in <module>
    dest.phase(phase_name).set_HAP_refinements(src_HAP, histograms='all')

  File
"/home/alxneit/share/miniconda3/envs/gsas/GSASII/GSASIIscriptable.py",
line 3553, in set_HAP_refinements
    .format(len(h['HStrain'][1]),self.name))

Exception: Need 4 HStrain terms for phase CuO




Run in spyder (Python 3.7.1 | packaged by conda-forge, IPython 7.2.0)
Python module versions loaded:
  Python:     3.7.2
  wx:         4.0.4
  matplotlib: 3.0.3
  numpy:      1.16.2
  scipy:      1.2.1
  OpenGL:     3.1.1a1
  PIL.Image:  5.4.1
  Platform:   linux 64bit x86_64
This is GSAS-II revision 4002

Any help appreciated
-- 
Dr. Ivo Alxneit
Catalysis for Energy Group
Bioenergy and Catalysis Laboratory        phone: +41 56 310 4092
Paul Scherrer Institute                     fax: +41 56 310 2688
CH-5232 Villigen                      gnupg key: 0x515E30C7
Switzerland
https://www.psi.ch/ceg/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.aps.anl.gov/pipermail/gsas-ii/attachments/20190529/a9d58b1d/attachment.sig>


More information about the GSAS-II mailing list