Skip to content

write mismatch with numpy.savetxt in sampling #1

Description

@saltzberg

Bruce found the error below when running workbench_executable.py. Unable to recreate on OSX and Fedora with numpy 1.11.2.

This occurs when the sigmas are written to log file. I suspect that it is because numpy.savetxt writes in binary and we pass it a file that has been opened in text mode?

The sigmas are written out at each step (rather than storing them). We could instead store it and write them at the end, as this write step probably slows down the calculation some.

170 Apo_score= 388.320098563 3339095_score= 369.400900234
180 Apo_score= 382.973455731 3339095_score= 372.586502734
190 Apo_score= 376.017419592 3339095_score= 510.183047531
WARNING: Running this sampling protocol will potentially overwrite results in directory  C:\dev\bayesian_hdx-master\examples\HDXWorkbench_example
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\numpy\lib\npyio.py", line 1158, in savetxt
    fh.write(asbytes(format % tuple(row) + newline))
TypeError: must be str, not bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "workbench_executable.py", line 143, in <module>
    outfile_prefix="Macro", outdir=outputdir)
  File "C:\dev\bayesian_hdx-master\pyext\src\sampling.py", line 39, in simulated_annealing
    save_results=True, outdir=outdir, outfile_prefix=outfile_prefix, noclobber=noclobber)
  File "C:\dev\bayesian_hdx-master\pyext\src\sampling.py", line 97, in do_mc_sampling
    numpy.savetxt( outfile3 , numpy.atleast_2d(sigs), "%f")
  File "C:\Python34\lib\site-packages\numpy\lib\npyio.py", line 1162, in savetxt
    % (str(X.dtype), format))
TypeError: Mismatch between array dtype ('float64') and format specifier ('%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions