Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week12 #26

Merged
merged 57 commits into from
Apr 22, 2021
Merged

Week12 #26

merged 57 commits into from
Apr 22, 2021

Conversation

sholmbo
Copy link
Member

@sholmbo sholmbo commented Mar 23, 2021

I had to add two keys to the config.ini under [api],

address = https://flows.phys.au.dk/api
catalog = https://flows.phys.au.dk/api

to enable the custom api.

And @emirkmo is to blame for the switch to spaces :p

emirkmo and others added 30 commits January 8, 2021 17:07
astroalign is sometimes returning false matches so we remove it for now until we can fix this. Also some changes to the wcs_checking loop to catch whether references left the frame or got near the edge after the new wcs.
@todo: this dependency can be removed with smarter numpy or astropy table usage.
@emirkmo
Copy link
Member

emirkmo commented Apr 9, 2021

Let's get this merged if we can. Any additions can come in future PRs. This is large enough..

@rhandberg
Copy link
Contributor

This will cause us to have to drop support for Python 3.6. This will cause problems for some of the systems currently running the automatic parts of the code, until we can get them upgraded. What is the reason for the strict "astropy >= 4.2" requirement?

@rhandberg
Copy link
Contributor

Please install all dependencies (pip install -r requirements.txt) and run "flake8" and fix any errors it finds.

@rhandberg
Copy link
Contributor

Why is it needed to have the API URL in the config file... This sounds to me like a way to open a security hole... I change that config to point to something nasty and bad things happen... And it will break existing setups if it is not defined

@rhandberg
Copy link
Contributor

Please the following lines in the beginning of all files:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
What does the code in this file do?

.. codeauthor:: Your Name <youremail@example.com>
"""

@rhandberg rhandberg added the enhancement New feature or request label Apr 14, 2021
Copy link
Contributor

@rhandberg rhandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename the "localweb" or "web" to something more describing? Like "local target plotting interface" or whatever...

flows/coordinatematch/wcs.py Outdated Show resolved Hide resolved
flows/load_image.py Outdated Show resolved Hide resolved
flows/load_image.py Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
web/api/catalogs.json Outdated Show resolved Hide resolved
web/api/datafiles.json Outdated Show resolved Hide resolved
web/api/sites.json Outdated Show resolved Hide resolved
web/api/targets.json Outdated Show resolved Hide resolved
@emirkmo
Copy link
Member

emirkmo commented Apr 14, 2021

This will cause us to have to drop support for Python 3.6. This will cause problems for some of the systems currently running the automatic parts of the code, until we can get them upgraded. What is the reason for the strict "astropy >= 4.2" requirement?"

I think my nearest neighbor WCS correction code needs Astropy 4.2, and we intend to have it as a backup. So we should upgrade all dependencies to python >3.6 and astropy >=4.2, but let's do that later. Possibly, we change my code to not need astropy 4.2. It's just that they added a nice WCS solver in 4.2 that works well for matched pairs.

@sholmbo sholmbo requested a review from rhandberg April 14, 2021 15:06
import photutils.psf


class EPSFBuilder(photutils.psf.EPSFBuilder):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as for the "WCS" object... Lets give it a new name so there is no confusion with the original EPSFBuilder... FlowsEPSFBuilder maybe?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're just copying and extending it, I think we should keep the same name. Then in the future if we move back to photutils EPSFBuilder, we don't have to refactor the code.

@@ -84,6 +85,9 @@ def load_image(FILENAME):
image.image = np.asarray(hdul[0].data, dtype='float64')
image.shape = image.image.shape

image.head = hdr
image.exthdu = [hdu.copy() for hdu in hdul[1:]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere? It is an expensive operation if not used for anything and we might as well just use the HDUList from the original FITS file if it is needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@@ -84,6 +85,9 @@ def load_image(FILENAME):
image.image = np.asarray(hdul[0].data, dtype='float64')
image.shape = image.image.shape

image.head = hdr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this to "header" instead of "head"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

from astropy.table import Table, vstack
from astropy.nddata import NDData
from astropy.modeling import models, fitting
from astropy.wcs.utils import proj_plane_pixel_area
from astropy.wcs.utils import proj_plane_pixel_area, fit_wcs_from_points
from astropy.time import Time

warnings.simplefilter('ignore', category=AstropyDeprecationWarning)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this warnings.simplefilter needed twice? (properly not)
The reason it was here originally was that photutils would throw warnings when importing... Is that still the case with the newer version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this for now yes, especially with our version fixing of Astropy/Photutils

@@ -0,0 +1,2 @@
from .coordinatematch import CoordinateMatch # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be specific on which warnings you are disabling. Never use the "disable all warnings" unless there is a REALLY good reason for it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are error F401 but we should ignore F401 by default on all init.py files.

emirkmo and others added 2 commits April 21, 2021 15:11
@codecov
Copy link

codecov bot commented Apr 21, 2021

Codecov Report

Merging #26 (d18dd43) into devel (847a5d2) will increase coverage by 0.51%.
The diff coverage is 12.29%.

❗ Current head d18dd43 differs from pull request most recent head 730fb73. Consider uploading reports for the commit 730fb73 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##            devel      #26      +/-   ##
==========================================
+ Coverage   16.81%   17.33%   +0.51%     
==========================================
  Files          22       28       +6     
  Lines        1564     1979     +415     
==========================================
+ Hits          263      343      +80     
- Misses       1301     1636     +335     
Impacted Files Coverage Δ
flows/load_image.py 7.05% <0.00%> (-0.34%) ⬇️
flows/photometry.py 10.58% <6.46%> (+2.37%) ⬆️
flows/wcs.py 11.29% <11.29%> (ø)
flows/coordinatematch/coordinatematch.py 11.97% <11.97%> (ø)
flows/coordinatematch/wcs.py 25.00% <25.00%> (ø)
flows/epsfbuilder/epsfbuilder.py 39.13% <39.13%> (ø)
flows/coordinatematch/__init__.py 100.00% <100.00%> (ø)
flows/epsfbuilder/__init__.py 100.00% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 847a5d2...730fb73. Read the comment docs.

@emirkmo
Copy link
Member

emirkmo commented Apr 21, 2021

Ok it’s ready to pull in

@rhandberg
Copy link
Contributor

Okay, I will merge this, but I will be doing some cosmetic changes afterwards

@rhandberg rhandberg merged commit 843304e into SNflows:devel Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants