Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gadget-4 snapshots #9

Open
cspotz opened this issue Aug 26, 2024 · 1 comment
Open

Gadget-4 snapshots #9

cspotz opened this issue Aug 26, 2024 · 1 comment

Comments

@cspotz
Copy link

cspotz commented Aug 26, 2024

Hello,
I tried to install and use cosmic_profile on my Gadget-4 simulation but get the following error :

  File "/automnt/data77/stahl/Scale/analysis/WDM/profiles/script.py", line 91, in <module>
    HDF5Ex()
  File "/automnt/data77/stahl/Scale/analysis/WDM/profiles/script.py", line 47, in HDF5Ex
    cprofiles = DensShapeProfsGadget(SNAP_DEST, GROUP_DEST, OBJ_TYPE, SNAP, VIZ_DEST, CAT_DEST, RVIR_OR_R200 = RVIR_OR_R200, MIN_NUMBER_PTCS = MIN_NUMBER_PTCS, CENTER = CENTER)
  File "cosmic_profiles/shape_profs/shape_profs_classes.pyx", line 573, in cosmic_profiles.shape_profs.shape_profs_classes.DensShapeProfsGadget.__init__
  File "/home/stahl/.local/lib/python3.9/site-packages/cosmic_profiles/gadget/readgadget.py", line 131, in read_block
    head    = header(filename)    
  File "/home/stahl/.local/lib/python3.9/site-packages/cosmic_profiles/gadget/readgadget.py", line 45, in __init__
    self.omega_m  = f['Header'].attrs[u'Omega0']
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "/home/stahl/.local/lib/python3.9/site-packages/h5py/_hl/attrs.py", line 56, in __getitem__
    attr = h5a.open(self._id, self._e(name))
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5a.pyx", line 80, in h5py.h5a.open
KeyError: "Can't open attribute (can't locate attribute: 'Omega0')"

I guess it comes from the format of my files, as the 'Header' in my snapshot_000.hdf5 does not contain Omega0 anymore :
Attributes in 'Header': ['BoxSize', 'Git_commit', 'Git_date', 'MassTable', 'NumFilesPerSnapshot', 'NumPart_ThisFile', 'NumPart_Total', 'Redshift', 'Time']
These are the attribute of my file
<KeysViewHDF5 ['Config', 'Header', 'Parameters', 'PartType1']>
and I think what you are trying to look for in line 45 of gadget/readgadget.py is now located in 'Parameters' :
<KeysViewHDF5 ['ActivePartFracForNewDomainDecomp', 'ActivePartFracForPMinsteadOfEwald', 'ArtBulkViscConst', 'BoxSize', 'ComovingIntegrationOn', 'CourantFac', 'CpuTimeBetRestartFile', 'DesLinkNgb', 'DesNumNgb', 'ErrTolForceAcc', 'ErrTolIntAccuracy', 'ErrTolTheta', 'ErrTolThetaMax', 'GravityConstantInternal', 'Hubble', 'HubbleParam', 'ICFormat', 'InitCondFile', 'InitGasTemp', 'MaxFilesWithConcurrentIO', 'MaxMemSize', 'MaxNumNgbDeviation', 'MaxSizeTimestep', 'MinEgySpec', 'MinSizeTimestep', 'NumFilesPerSnapshot', 'Omega0', 'OmegaBaryon', 'OmegaLambda', 'OutputDir', 'OutputListFilename', 'OutputListOn', 'SnapFormat', 'SnapshotFileBase', 'SofteningClassOfPartType0', 'SofteningClassOfPartType1', 'SofteningClassOfPartType2', 'SofteningClassOfPartType3', 'SofteningClassOfPartType4', 'SofteningClassOfPartType5', 'SofteningComovingClass0', 'SofteningMaxPhysClass0', 'TimeBegin', 'TimeBetSnapshot', 'TimeBetStatistics', 'TimeLimitCPU', 'TimeMax', 'TimeOfFirstSnapshot', 'TopNodeFactor', 'TypeOfOpeningCriterion', 'UnitLength_in_cm', 'UnitMass_in_g', 'UnitVelocity_in_cm_per_s']>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@cspotz and others