Skip to content
Snippets Groups Projects
Select Git revision
  • eb6526614967187ae4f88bd3e3b34d2ab29f3242
  • master default protected
  • dev protected
  • replication_test
  • release-1.10 protected
  • release-1.9 protected
  • 551-init-broker-service-permissions
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • 485-fixity-checks
  • 530-various-schema-problems-with-subsets
  • release-1.7 protected
  • v1.10.2 protected
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
  • v1.9.2 protected
  • v1.9.2-rc0 protected
41 results

Dockerfile

Blame
  • create_ics_from_snapshot.py 1.42 KiB
    
    import h5py
    import sys
    
    def ics_from_snapshot(inputfile, outputfile):
        f_input  = h5py.File(inputfile, 'r')
        f_output = h5py.File(outputfile, 'w')
    
        f_input.copy('Header', f_output)
        f_input.copy('Units', f_output)
    
        g_PT0 = f_output.create_group('PartType0')
        g_PT4 = f_output.create_group('PartType4')
    
        f_input.copy('PartType0/Coordinates', g_PT0)
        f_input.copy('PartType0/InternalEnergies', g_PT0)  # InternalEnergy
        f_input.copy('PartType0/Masses', g_PT0)
        f_input.copy('PartType0/ParticleIDs', g_PT0)
        f_input.copy('PartType0/SmoothingLengths', g_PT0)   # SmoothingLength
        f_input.copy('PartType0/Velocities', g_PT0)
    
        f_input.copy('PartType4/Coordinates', g_PT4)
        f_input.copy('PartType4/Masses', g_PT4)
        f_input.copy('PartType4/ParticleIDs', g_PT4)
        f_input.copy('PartType4/BirthTimes', g_PT4)  # StellarFormationTime 
        f_input.copy('PartType4/Velocities', g_PT4)
    
        f_output['PartType4/StellarFormationTime'] = f_output['PartType4/BirthTimes']
        del f_output['PartType4/BirthTimes']
    
        f_output['PartType0/SmoothingLength'] = f_output['PartType0/SmoothingLengths']
        del f_output['PartType0/SmoothingLengths']
    
        f_output['PartType0/InternalEnergy'] = f_output['PartType0/InternalEnergies']
        del f_output['PartType0/InternalEnergies']
    
        grp = f_output.create_group('Info')
        grp.attrs["Input file"] = inputfile
         
        f_input.close()
        f_output.close()
    
        return