Skip to content

Commit bbcbf86

Browse files
author
Paul Müller
committed
- possibly fixed error with safe_dump on Mac OSx 10.8.5
- update changelog for version 0.9.4
1 parent 3dd4762 commit bbcbf86

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ChangeLog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
0.9.4
2+
- Batch control allows to select individual parameters (#108)
3+
- Allow to exclude pages from batch fitting (#107)
4+
- Bugfixes:
5+
- Fix `ValueError` in parameter display
6+
- Possibly fixed error with `yaml.safe_dump`
7+
on Mac OSx 10.8.5
8+
- Make sure background is lower than signal (#137)
19
0.9.3
210
- Fitting: migrate to lmfit
311
- This introduces a new dependency for building PyCorrFit.

pycorrfit/openfile.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,22 @@ def SaveSessionData(sessionfile, Infodict):
333333
# Range of fitting parameters
334334
Parms[idparm][9] = np.array(Parms[idparm][9],dtype="float").tolist()
335335
Parmlist.append(Parms[idparm])
336-
yaml.safe_dump(Parmlist, open(parmsfilename, "wb"))
336+
try:
337+
# We would like to perform safe_dump, because in the
338+
# Windoes x64 version, some integers are exported
339+
# like this: `!!python/long '105'` using `yaml.dump`.
340+
with open(parmsfilename, "wb") as yamlfd:
341+
yaml.safe_dump(Parmlist, yamlfd)
342+
except:# yaml.representer.RepresenterError:
343+
# This error occured once on Mac OS 10.8.5:
344+
# `RepresenterError: cannot represent an object: 0`
345+
# In this case, we choose to use the normal dump
346+
# and pray.
347+
if os.path.exists(parmsfilename):
348+
os.remove(parmsfilename)
349+
with open(parmsfilename, "wb") as yamlfd:
350+
yaml.dump(Parmlist, yamlfd)
351+
337352
Arc.write(parmsfilename)
338353
os.remove(os.path.join(tempdir, parmsfilename))
339354
# Supplementary data (errors of fit)

0 commit comments

Comments
 (0)