Closed tkittel closed 7 years ago
Hi Thomas, as we discussed in private, there is interest in the python script you are developing. It seems Sebastian Jaksch will become one of the first users of it. He's had some problems with his reader, so I advised him to have a look at your progress.
What's your plan with finalizing it?
Hi Kelly,
That depends a bit on how much time I manage to find for this, between other projects, but I will of course increase the priority if someone is actually waiting for it :-)
The code you might have stumbled across in dgcode is NOT ready for any usage yet, and I would like to at least validate it slightly before anyone else than me uses it - so please don't go and grab it from there just yet. I still have some basic validation + platform checks to do, once those are done I can attach the file here to this issue so Sebastian can get access to it immediately (if he is comfortable being a guinea pig).
After it is completely verified, I plan to release MCPL 1.1.1 with that file in it as well, which would go along with adding documentation on a new "python usage" section below https://mctools.github.io/mcpl/usage/.
It would be useful if you could ask Sebastian to come here to this issue and let me know about the platforms he intends to use it on. Specifically the output of the following commands would be useful:
python --version
python -c 'import numpy; print numpy.__version__'
Although plotting itself would not be part of the initial version, I think having an easy way to generate some standard plots with a standard script would be useful, so I would appreciate feedback from you and Sebastian regarding which matplotlib versions you are using.
(Sebastian answered per email)
There is still a lot of work on documentation, benchmarking, etc. before it can become part of the MCPL release itself, but the prototype mcpl.py module is good enough for Sebastian to try out and provide feedback now:
(I had to rename it from mcpl.py to mcpl.py.txt before the site allowed me to attach it here).
So please download it and save it in your run directory as mcpl.py, then you can run code like:
#!/usr/bin/env python
import mcpl
#help(mcpl) #<-- uncomment for module documentation
f=mcpl.MCPLFile('example.mcpl')
f.dump_hdr()
#Loop over all particles and print their positions:
for p in f.particles:
print p.x,p.y,p.z
#help(p) #<-- uncomment to see all field names
#Same, but each iteration will be over a big "block" of 1000 particles, so all
#fields are now arrays of length 1000.
for p in f.particle_blocks:
print p.x,p.y,p.z
#NB: change blocklength to, say, 10000, by opening file with:
# mcpl.MCPLFile('example.mcpl',blocklength=10000)
Let me know of any feedback or questions!
Answering your question about software versions:
On centos7: python -> 2.7.5 numpy -> 1.7.1 matplotlib -> 1.2.0
On osx sierra 10.12.3: python -> 2.7.13 numpy -> 1.12.0 matplotlib -> 2.0.0
MCPL release 1.2.0 was just released, with the main new feature being the python support that started with this issue. Of course, the module ended up a lot nicer and polished than the early work linked in my earlier comment. Find more details at:
https://mctools.github.io/mcpl/usage_python/ https://mctools.github.io/mcpl/usage_cmdline/
Closing here, feedback is of course still appreciated.
Will facilitate both compilation-less access, as well as plotting.