From 3ec21a59cb27dc37c395a0959bb67ae8a43dc945 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 5 Oct 2022 22:24:42 -0300 Subject: [PATCH 1/3] PYTHON: Fix reading pressure. Signed-off-by: Grzegorz Kowal --- python/amunpy/src/amunpy/amun.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/amunpy/src/amunpy/amun.py b/python/amunpy/src/amunpy/amun.py index 1a045cc..c6be042 100644 --- a/python/amunpy/src/amunpy/amun.py +++ b/python/amunpy/src/amunpy/amun.py @@ -182,7 +182,7 @@ class Amun: self.variables['density'] = 'dens' self.variables['logarithm of density'] = 'logd' if 'pres' in self.variables: - self.variables['pressure'] = 'dens' + 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' From 9190efe4a8ebfeb7409a70d1d509d9df40212c0e Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Thu, 6 Oct 2022 07:58:37 -0300 Subject: [PATCH 2/3] PYTHON: Add pressure for the isothermal case. Signed-off-by: Grzegorz Kowal --- python/amunpy/src/amunpy/amun.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/amunpy/src/amunpy/amun.py b/python/amunpy/src/amunpy/amun.py index c6be042..1442334 100644 --- a/python/amunpy/src/amunpy/amun.py +++ b/python/amunpy/src/amunpy/amun.py @@ -181,7 +181,7 @@ class Amun: if 'dens' in self.variables: self.variables['density'] = 'dens' self.variables['logarithm of density'] = 'logd' - if 'pres' in self.variables: + 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']): @@ -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 From 0badf0d1435ed16c78764abf9ae307045cda685d Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Thu, 6 Oct 2022 13:08:22 -0300 Subject: [PATCH 3/3] PYTHON: Increase amunpy version to 0.9.7. Signed-off-by: Grzegorz Kowal --- python/amunpy/setup.py | 2 +- python/amunpy/src/amunpy/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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"