Commit 2e2b9e0a authored by skamann's avatar skamann
Browse files

Made code compatible with the latest pandas versions

parent ca677395
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (pampelmuse)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (pampelmuse)" project-jdk-type="Python SDK" />
<component name="PyPackaging">
<option name="earlyReleasesAsUpgrades" value="true" />
</component>
......
......@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (pampelmuse)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10 (pampelmuse)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PackageRequirementsSettings">
......
......@@ -58,7 +58,7 @@ the data into memory yet but just checks whether the file(s) are valid.
Latest Git revision
-------------------
2022/02/18
2022/05/21
"""
import argparse
import importlib
......@@ -78,7 +78,7 @@ from pampelmuse.utils.fits import read_config_from_header
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__version__ = "1.0"
__revision__ = 20220218
__revision__ = 20220522
logger = logging.getLogger(__name__)
......@@ -90,7 +90,7 @@ if __name__ == "__main__":
(::;;) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (::;;)
`;:' `;:'
(c) 2013-2020 {1}
(c) 2013-2022 {1}
""".format(__version__, __author__))
sys.stdout.write("""
......
......@@ -31,7 +31,7 @@ extraction for a data cube.
Latest GIT revision
-------------------
2022/03/09
2022/05/21
"""
import collections
import logging
......@@ -45,7 +45,7 @@ from ..instruments.muse import MusePixtable
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__revision__ = 20220309
__revision__ = 20220521
logger = logging.getLogger(__name__)
......@@ -679,7 +679,7 @@ class FitCube(object):
mask = np.isnan(values)
logger.debug("Layer contains {0} masked pixels".format(mask.sum()))
else:
mask = np.zeros(values.size, dtype=np.bool)
mask = np.zeros(values.size, dtype=bool)
# collect arrays in dictionary for initialisation of pandas DataFrame
data = {'value': values[~mask], 'x': transform[~mask, 1], 'y': transform[~mask, 0]}
......
......@@ -32,7 +32,7 @@ coordinate transformation from reference to IFS coordinates.
Latest Git revision
-------------------
2021/04/20
2021/05/21
"""
import logging
import numpy as np
......@@ -42,7 +42,7 @@ from astropy.io import fits
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__revision__ = 20210420
__revision__ = 20220521
logger = logging.getLogger(__name__)
......@@ -102,7 +102,7 @@ class Parameters(object):
# check if data frame is sufficiently ordered for slicing
# check: http://pandas.pydata.org/pandas-docs/stable/advanced.html#using-slicers
if not self.data.columns.is_lexsorted():
if not self.data.columns.is_monotonic_increasing:
logger.warning('Data frame containing parameters not sorted. Reordering ...')
self.data = self.data.sort_index(level=0, axis=1) # axis=1 = columns
......
......@@ -37,7 +37,7 @@ memory but only on request.
Latest Git revision
-------------------
2021/04/20
2022/05/21
"""
import collections
import logging
......@@ -59,7 +59,7 @@ except ImportError:
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__revision__ = 20210420
__revision__ = 20220522
logger = logging.getLogger(__name__)
......@@ -1004,7 +1004,7 @@ class Sources(object):
self._wave -= (self.crpix - 1)
self._wave *= self.cdelt
self._wave += self.crval
return pd.Float64Index(self._wave)
return pd.Index(self._wave, dtype=np.float64)
@wave.setter
def wave(self, value):
......@@ -1408,7 +1408,7 @@ class Sources(object):
# initialize data frame for coordinates data.
# rows contain dispersion data using the actual wavelengths as a pandas Float64Index
index = pd.Float64Index(self.wave[layers])
index = pd.Index(self.wave[layers], dtype=np.float64)
# columns contain IDs, ('x', 'y'), and ('value', 'fit') in a pandas.MultiIndex
axes = ['x', 'y']
......@@ -1470,7 +1470,7 @@ class Sources(object):
# check if data frame is sufficiently ordered for slicing
# check: http://pandas.pydata.org/pandas-docs/stable/advanced.html#using-slicers
if not self.ifs_coordinates.columns.is_lexsorted():
if not self.ifs_coordinates.columns.is_monotonic_increasing:
logger.warning('Data frame containing IFS coordinates not sorted. Reordering ...')
self.ifs_coordinates = self.ifs_coordinates.sort_index(level=0, axis=1) # axis=1 = columns
......
......@@ -11,6 +11,6 @@ setup(
packages=find_packages(),
scripts=['bin/PampelMuse', ],
package_data={'pampelmuse.config': ['data/pampelmuse.json', ], 'pampelmuse.filters': ['data/*', ]},
install_requires=['numpy', 'scipy', 'astropy', 'matplotlib', 'pandas>1.0,<1.3', 'PyQt5', 'tqdm'],
install_requires=['numpy', 'scipy', 'astropy', 'matplotlib', 'pandas>1.3', 'PyQt5', 'tqdm'],
extras_require={'nfm': 'maoppy>=1.5.0'}
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment