Dear experts,
Recently I am trying to simulating incident low energy proton( <10MeV ) react with Boron-11 target, the PhysicsList is “QGSP_BIC_AllHP”, I want to find the cross section data of (p,α), so I checked the files in G4_Data\G4TENDL1.3.2\Proton\Inelastic\CrossSection folder, but all the data files are “.z” files(say,“5_11_Boron.z”), I have trired all the methods as far as I know, still I can’t open these files, so please tell me how to open( or uncompress) these .z files, thanks!
Hello,
these are zlib compressed files. To uncompress these files, see e.g. https://unix.stackexchange.com/questions/22834/how-to-uncompress-zlib-data-in-unix.
For example to uncompress 5_11_Boron.z use:
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" |cat - 5_11_Boron.z |gzip -dc >/tmp/5_11_Boron
Gunter
Thanks, Gunter! It works for me!
Hi, gunter,
If I have a file, how can I compress it to .z for geant4? Thank you very much!
Thank you.
For my case there was a error with next message:
“gzip: stdin: unexpected end of file”
Don’t know why it is not work for me, may be because linux mint. But on the link you attached i found the working method for me. It is for uncompressing 1_3_Hydrogen.z for example:
zlib-flate -uncompress < 1_3_Hydrogen.z > 1_3_Hydrogen
Hello iquano,
Using the stackexcange post, and adapting the python code posted for uncompression to compression, you can use the following:
import zlib
with open('test', 'rb') as input:
uncomp=input.read()
input.close()
z=zlib.compress(uncomp)
with open('test.z', 'wb') as f:
f.write(z)
f.close()
The input file here is called test, creating the compressed test.z
Hello,
yes, gzip gives this warning, but the result is correct. zlib-flate is not installed on many systems, if this works for you, very good.
Thank you very much! Best wishes!