Skip to content

Commit

Permalink
Merge branch 'master' of github.com:volodymyrss/pymosaics
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrigno committed Jan 12, 2024
2 parents 5345c1a + b67a191 commit 56c15ab
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 20 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .[tests]
- name: Install sextractor
run: |
sudo apt-get install -y fftw3 fftw3-dev pkg-config libblas-dev liblapack-dev libatlas-cpp-0.6-dev g++ make automake autoconf libtool libatlas-base-dev
curl -L https://github.com/astromatic/sextractor/archive/refs/tags/2.25.0.tar.gz | tar xzf -
cd sextractor-2.25.0
bash autogen.sh
./configure
sudo make install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.2
0.4.5
37 changes: 20 additions & 17 deletions mosaic/treat.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,28 +331,31 @@ def get_total_ebands(self):
# print("found bands:", (len(gt) - 1) / 4)
return int((len(gt) - 1) / 4)

def get_imatype(self, myhead):
extname=''
imatype=''
if 'EXTNAME' in myhead.keys():
extname = myhead['EXTNAME']
if 'IMATYPE' in myhead.keys():
imatype = myhead['IMATYPE']

# Priority on IMATYPE !
def get_imatype(self, myhead, default=None):
imatype = myhead.get('IMATYPE', '')
extname = myhead.get('EXTNAME', '')

# Priority on IMATYPE !
if imatype != '':
return imatype
elif extname != '':
return extname
else:
raise KeyError('Both EXTNAME and IMATYPE are empty, impossible to get image type')

def get_extension_by_type(self, exttype):
ff = fits.open(self.get_mosaic_fn())
h_ret = None
for hh in ff:
if self.get_imatype(hh.header) == exttype:
h_ret = hh
if default is None:
raise KeyError('Both EXTNAME and IMATYPE are empty, impossible to get image type')
else:
return default

def get_extension_by_type(self, exttype: str):
with fits.open(self.get_mosaic_fn()) as ff:
h_ret = None
for hh in ff:
if self.get_imatype(hh.header, '') == exttype:
if h_ret is not None:
raise NotImplementedError(f"found two extensions for requested type {exttype}")

h_ret = hh.copy()

# Cannot close for way of dealing with input of this class
#ff.close()
if h_ret is not None:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = 'setuptools.build_meta'
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.2
current_version = 0.4.5
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down Expand Up @@ -55,6 +55,7 @@ install_requires =
healpy
click
matplotlib
pandas
tests_require =
pytest
mypy
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

setup(description="pymosaic-fits",
long_description=open('README.md').read(),
version='0.4.2',
version='0.4.5',
include_package_data=True,
setup_requires=setup_requires)
12 changes: 12 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tox]
envlist =
py39
requires =
setuptools >= 30.3.0
pip >= 19.3.1

isolated_build = true

[testenv]
deps = pytest
commands = pytest {posargs}

0 comments on commit 56c15ab

Please sign in to comment.