henjo / libpsf

PSF simulation data c++ library
GNU Lesser General Public License v3.0
26 stars 23 forks source link

Support for designParamVals.info #7

Open michaelnt opened 12 years ago

michaelnt commented 12 years ago

designParamVals.info seems to be in text format.

Trying to load it into a PSFDataSet and running get_header_properties segfaults.

michaelnt commented 12 years ago

psfasc from pycircuit can be used, not sure if the intention is that libpsf is used via pycircuit or directly.

from pycircuit.post.cds import psfasc
ascfile = psfasc.parse("psfasc", open(self.result_dir + "/psf/designParamVals.info").read())
self._params = dict(ascfile.values.children[0].value.getValue())
henjo commented 12 years ago

Ideally libpsf should handle ASCII PSF files but currently it doesn't and it is not trivial to add support for it. The idea is that libpsf should be usable directly and not only through pycircuit.

In the meantime I changed resultpsf in pycircuit to fall back to the Python PSF reader if it identify the file as a PSF ascii file.

I have also added an exception that will be thrown when PSFDataset is instantiated with an invalid file (like PSF ascii).