diff --git a/python/amunpy/setup.py b/python/amunpy/setup.py index 198f493..1bb900b 100644 --- a/python/amunpy/setup.py +++ b/python/amunpy/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setuptools.setup( name="amunpy", - version="0.9.6", + version="0.9.7", author="Grzegorz Kowal", author_email="grzegorz@amuncode.org", description="Python Interface for the AMUN code's snapshots", diff --git a/python/amunpy/src/amunpy/__init__.py b/python/amunpy/src/amunpy/__init__.py index 4d338fb..84ac54c 100644 --- a/python/amunpy/src/amunpy/__init__.py +++ b/python/amunpy/src/amunpy/__init__.py @@ -21,6 +21,6 @@ __all__ = [ 'AmunXML', 'AmunH5', 'WriteVTK', \ __author__ = "Grzegorz Kowal" __copyright__ = "Copyright 2018-2022 Grzegorz Kowal " -__version__ = "0.9.6" +__version__ = "0.9.7" __maintainer__ = "Grzegorz Kowal" __email__ = "grzegorz@amuncode.org" diff --git a/python/amunpy/src/amunpy/amun.py b/python/amunpy/src/amunpy/amun.py index 1a045cc..1442334 100644 --- a/python/amunpy/src/amunpy/amun.py +++ b/python/amunpy/src/amunpy/amun.py @@ -181,8 +181,8 @@ class Amun: if 'dens' in self.variables: self.variables['density'] = 'dens' self.variables['logarithm of density'] = 'logd' - if 'pres' in self.variables: - self.variables['pressure'] = 'dens' + if 'pres' in self.variables or self.attributes['eos'] == 'iso': + self.variables['pressure'] = 'pres' self.variables['logarithm of pressure'] = 'logp' if all(v in self.variables for v in ['velx','vely','velz']): self.variables['velocity'] = 'vvec' @@ -258,8 +258,16 @@ class Amun: dset[p,...] = self.chunks[chunk_number]['levels'][p] elif dataset == 'logd': dset = numpy.log10(self.__read_binary_data__('dens', chunk_number)) + elif dataset == 'pres': + if self.attributes['eos'] == 'iso': + dset = self.__read_binary_data__('dens', chunk_number) * self.attributes['sound_speed']**2 + else: + dset = self.__read_binary_data__('pres', chunk_number) elif dataset == 'logp': - dset = numpy.log10(self.__read_binary_data__('pres', chunk_number)) + if self.attributes['eos'] == 'iso': + dset = numpy.log10(self.__read_binary_data__('dens', chunk_number) * self.attributes['sound_speed']**2) + else: + dset = numpy.log10(self.__read_binary_data__('pres', chunk_number)) elif dataset == 'velo': tmp = self.__read_binary_data__('velx', chunk_number) dset = tmp**2