diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 0d2bea3..b710c74 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -27,15 +27,6 @@ jobs:
with:
python-version: 3.9
- - name: Cache pip
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-py3.9-${{ hashFiles('requirements.txt') }}
- restore-keys: |
- ${{ runner.os }}-pip-py3.9-
- ${{ runner.os }}-pip-
-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
@@ -46,9 +37,9 @@ jobs:
run: |
# stop the build if there are Python syntax errors or undefined names
# For some reason we have to specifically ignore G001 as well
- flake8 --select=E9,F63,F7,F82 --ignore=G001,G004 --show-source
+ flake8 --select=E9,F63,F7,F82 --show-source --ignore=G001,G004
# exit-zero treats all errors as warnings.
- flake8 --exit-zero
+ # flake8 --exit-zero
# Run unit tests on Linux, OSX and Windows
pytest:
diff --git a/README.rst b/README.rst
index cba0a52..1cfcd37 100644
--- a/README.rst
+++ b/README.rst
@@ -20,9 +20,10 @@ Installation instructions
>>> git clone https://github.com/SNflows/flows.git .
-* All dependencies can be installed using the following command. It is recommended to do this in a dedicated `virtualenv `_ or similar:
+* Required dependencies can be installed using the following command. It is recommended to do this in a dedicated `virtualenv `_ or similar:
>>> pip install -r requirements.txt
+ >>> pip install -r requirements_dev.txt # for tests/development
* Last step is to create a config-file. Create a file named "config.ini" and place it in the "flows" directory. Make sure that the file can only be read by you (``chmod 0600 config.ini``)!
This file can contain all the settings for running the pipeline. A minimal file for working with the pipeline is
diff --git a/flows/reference_cleaning.py b/flows/reference_cleaning.py
index 839c839..67b74cd 100644
--- a/flows/reference_cleaning.py
+++ b/flows/reference_cleaning.py
@@ -88,11 +88,22 @@ def add_target(self, target: Target, starid: int = 0) -> None:
self.xy = np.vstack(((target.pixel_column, target.pixel_row), self.xy))
-def use_sep(image: FlowsImage):
+def use_sep(image: FlowsImage, tries: int = 5, thresh: float = 5.):
+
# Use sep to for soure extraction
sep_background = sep.Background(image.image, mask=image.mask)
- objects = sep.extract(image.image - sep_background, thresh=5., err=sep_background.globalrms, mask=image.mask,
- deblend_cont=0.1, minarea=9, clean_param=2.0)
+ try:
+ objects = sep.extract(image.image - sep_background, thresh=thresh, err=sep_background.globalrms,
+ mask=image.mask, deblend_cont=0.1, minarea=9, clean_param=2.0)
+ except KeyboardInterrupt:
+ raise
+ except Exception:
+ logger.warning("SEP failed, trying again...")
+ if tries > 0:
+ thresh += 3
+ return use_sep(image, tries - 1, thresh * 2)
+ else:
+ raise
return References(table=objects)
diff --git a/setup.cfg b/setup.cfg
index e18cff9..1ca59e3 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -9,22 +9,38 @@ extend-ignore = E203
enable-extensions = G
ignore =
- G004, # logger does not optimizes f strings but __str__ calls are ok for us.
- E117, # over-indented (set when using tabs)
- E127, # continuation line over-indented for visual indent
- E128, # continuation line under-indented for visual indent
- E201, # whitespace after '('
- E202, # whitespace before ')'
- E265, # block comment should start with '# '
- E231, # missing whitespace after ','
- E226, # missing whitespace around arithmetic operator
- E261, # at least two spaces before inline comment
- E302, # expected 2 blank lines, found 1
- E305, # expected 2 blank lines after class or function definition, found 1
- E501, # line too long
- E701, # multiple statements on one line (colon)
- W503, # Line break occurred before a binary operator
- ET128, # (flake8-tabs) unexpected number of tabs and spaces at start of XXX
+ G004,
+ # logger does not optimizes f strings but __str__ calls are ok for us.
+ E117,
+ # over-indented (set when using tabs)
+ E127,
+ # continuation line over-indented for visual indent
+ E128,
+ # continuation line under-indented for visual indent
+ E201,
+ # whitespace after '('
+ E202,
+ # whitespace before ')'
+ E265,
+ # block comment should start with '# '
+ E231,
+ # missing whitespace after ','
+ E226,
+ # missing whitespace around arithmetic operator
+ E261,
+ # at least two spaces before inline comment
+ E302,
+ # expected 2 blank lines, found 1
+ E305,
+ # expected 2 blank lines after class or function definition, found 1
+ E501,
+ # line too long
+ E701,
+ # multiple statements on one line (colon)
+ W503,
+ # Line break occurred before a binary operator
+ ET128,
+ # (flake8-tabs) unexpected number of tabs and spaces at start of XXX
[tool:pytest]
addopts = --strict-markers --durations=10