Commit ec4479ff authored by skamann's avatar skamann
Browse files

Fixed bug in CUBEFIT affecting cases with background components completely...

Fixed bug in CUBEFIT affecting cases with background components completely outside the field of view.
parent fe33cb50
......@@ -2,7 +2,7 @@
"""
PampelMuse
==========
Copyright 2013-2020 Sebastian Kamann
Copyright 2013-2021 Sebastian Kamann
This file is part of PampelMuse.
......@@ -58,7 +58,7 @@ the data into memory yet but just checks whether the file(s) are valid.
Latest Git revision
-------------------
2020/09/29
2021/01/18
"""
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__ = 20200929
__revision__ = 20210118
logger = logging.getLogger(__name__)
......
"""
fit_cube.py
===========
Copyright 2013-2020 Sebastian Kamann
Copyright 2013-2021 Sebastian Kamann
This file is part of PampelMuse.
......@@ -31,7 +31,7 @@ extraction for a data cube.
Latest GIT revision
-------------------
2020/04/16
2021/01/18
"""
import collections
import logging
......@@ -45,7 +45,7 @@ from ..instruments.muse import MusePixtable
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__revision__ = 20200416
__revision__ = 20210118
logger = logging.getLogger(__name__)
......@@ -547,6 +547,13 @@ class FitCube(object):
self.background.slices = data['slice'].values
background_matrix, background_components = self.background.get_sparse_matrix(
offset=self.sources.n_components - self.sources.n_background, purge_empty=True)
# in case one or more background components are outside the FoV, their entries in 'fluxes' need to be
# removed
missing = fluxes[self.sources.specrow_background].index.difference(background_components)
if len(missing) > 0:
fluxes.drop(index=missing, inplace=True)
logger.warning('Background component(s) without contribution encountered: {0}'.format(missing))
else:
background_matrix = background_components = None
......
"""
fit_array.py
============
Copyright 2013-2020 Sebastian Kamann
Copyright 2013-2021 Sebastian Kamann
This file is part of PampelMuse.
......@@ -57,19 +57,23 @@ parameters are not fitted.
Latest Git revision
-------------------
2020/03/06
2021/01/18
"""
import collections
import contextlib
import io
import logging
import scipy
import time
import tqdm
import numpy as np
import pandas as pd
from scipy import interpolate, optimize, sparse
from scipy.sparse import linalg
from scipy.stats import median_absolute_deviation as mad
if scipy.__version__ < '1.5.0':
from scipy.stats import median_absolute_deviation as mad
else:
from scipy.stats import median_abs_deviation as mad
from astropy.stats import sigma_clip
from ..psf.profiles import *
......@@ -77,7 +81,7 @@ from ..core.coordinates import Transformation
__author__ = "Sebastian Kamann (s.kamann@ljmu.ac.uk)"
__revision__ = 20200306
__revision__ = 20210118
logger = logging.getLogger(__name__)
......
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