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

Finish photometry notebooks #381

Merged
merged 24 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
41416b3
WIP photometry run settings
mwcraig Jul 3, 2024
843a9ad
Make sure comparison viewer auto-saves source location settings
mwcraig Jul 4, 2024
2cd032c
Trim unused code from comparison viewer
mwcraig Jul 4, 2024
cce8a7e
Add template notebook for photometry runner
mwcraig Jul 4, 2024
8d11f2a
Move FitsOpener into settings
mwcraig Jul 4, 2024
2f7c1e8
Add run launcher class and corresponding notebook
mwcraig Jul 16, 2024
abad724
Update stellarphot/settings/custom_widgets.py
mwcraig Jul 16, 2024
afa193b
Change variable name
mwcraig Jul 16, 2024
a90e88f
Fix test to reflect changed error message
mwcraig Jul 17, 2024
e211e3b
Formatting fix
mwcraig Jul 17, 2024
808ccd1
Update photometry run launcher notebook
mwcraig Jul 18, 2024
4f30dd7
Document PhotometryRunner
mwcraig Jul 18, 2024
6797c1d
Fix location of test file
mwcraig Jul 19, 2024
364b4f6
Make API of ComparisonViewer more similar to SeeingProfile
mwcraig Jul 19, 2024
4c32a40
Suppress warnings
mwcraig Jul 19, 2024
0721974
Make loading and display of image less confusing
mwcraig Jul 19, 2024
51330e5
Add code to supress harmless FITS warnings
mwcraig Jul 19, 2024
064fe85
Remove debugging print
mwcraig Jul 19, 2024
4efc7a3
Add class for combined seeing profile and comparison stars
mwcraig Jul 19, 2024
3183f87
Add notebook that uses seeing+comparison widget
mwcraig Jul 19, 2024
e930952
Remove obsolete notebook
mwcraig Jul 22, 2024
bad1ac5
Add new notebook to JupyterLab launcher
mwcraig Jul 22, 2024
3050ff6
Add tests and fix imports for new class
mwcraig Jul 23, 2024
65f4e5b
Add remote_data marker
mwcraig Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .jp_app_launcher_stellarphot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
type: notebook
catalog: Stellarphot photometry

- title: 2 - Seeing profile
description: Choose aperture settings
source: ../stellarphot/photometry/01-viewer-seeing-template.ipynb
- title: 2 - Seeing profile and comparison stars
description: Choose aperture settings and stars to perform photometry on
source: ../stellarphot/02-seeing-and-comparison.ipynb
icon: ../stellarphot/stellarphot-logo.svg
cwd: not_used
type: notebook
catalog: Stellarphot photometry

- title: 3 - Comparison stars
description: Choose comparison stars
source: ../stellarphot/photometry/02-comp-star-plotter-template.ipynb
icon: ../stellarphot/stellarphot-logo.svg
cwd: not_used
type: notebook
catalog: Stellarphot photometry
# - title: 3 - Comparison stars
# description: Choose comparison stars
# source: ../stellarphot/photometry/02-comp-star-plotter-template.ipynb
# icon: ../stellarphot/stellarphot-logo.svg
# cwd: not_used
# type: notebook
# catalog: Stellarphot photometry

- title: 4 - Review settings
description: Choose comparison stars
Expand Down
206 changes: 0 additions & 206 deletions autoui_widget_viewer.ipynb

This file was deleted.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies = [
"ipywidgets",
"jupyter-app-launcher",
"matplotlib",
"papermill",
JuanCab marked this conversation as resolved.
Show resolved Hide resolved
"pandas",
"photutils >=1.9",
"pydantic >=2",
Expand Down Expand Up @@ -178,4 +179,6 @@ filterwarnings = [
'ignore:RADECSYS=:',
# photutils changed the name of a function again
'ignore:The make_gaussian_sources_image function is deprecated',
# papermill is using deprecated jupyter paths
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
]
2 changes: 1 addition & 1 deletion stellarphot/gui_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

from .comparison_functions import *
from .fits_opener import *
from .photometry_widget_functions import *
from .profile_and_comps import *

Check warning on line 5 in stellarphot/gui_tools/__init__.py

View check run for this annotation

Codecov / codecov/patch

stellarphot/gui_tools/__init__.py#L5

Added line #L5 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

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

As near as I can tell this warning about code coverage is in error! You test these functions with gui_tools/tests/test_profile_and_comps.py. Not sure why it is failing. Possibly because you import ComparisonAndSeeing instead of profile_and_comps (yes, they are equivalent, but I don't know if Codecov knows that).

from .seeing_profile_functions import *
27 changes: 15 additions & 12 deletions stellarphot/gui_tools/comparison_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from astrowidgets.ginga import ImageWidget

from stellarphot import SourceListData
from stellarphot.gui_tools.fits_opener import FitsOpener
from stellarphot.gui_tools.seeing_profile_functions import set_keybindings
from stellarphot.settings import (
PartialPhotometrySettings,
Expand All @@ -22,6 +21,7 @@
ui_generator,
)
from stellarphot.settings.custom_widgets import SettingWithTitle
from stellarphot.settings.fits_opener import FitsOpener
from stellarphot.utils.comparison_utils import (
crossmatch_APASS2VSX,
in_field,
Expand All @@ -34,7 +34,7 @@
DESC_STYLE = {"description_width": "initial"}


def make_markers(iw, ccd, RD, vsx, ent, name_or_coord=None):
def make_markers(iw, RD, vsx, ent, name_or_coord=None):
"""
Add markers for APASS, TESS targets, VSX. Also center on object/coordinate.

Expand All @@ -44,9 +44,6 @@ def make_markers(iw, ccd, RD, vsx, ent, name_or_coord=None):
iw : `astrowidgets.ImageWidget`
Ginga widget.

ccd : `astropy.nddata.CCDData`
Sample image.

RD : `astropy.table.Table`
Table with target information, including a
`astropy.coordinates.SkyCoord` column.
Expand All @@ -66,7 +63,6 @@ def make_markers(iw, ccd, RD, vsx, ent, name_or_coord=None):
None
Markers are added to the image in Ginga widget.
"""
iw.load_nddata(ccd)
iw.zoom_level = "fit"

try:
Expand Down Expand Up @@ -278,17 +274,22 @@ def __init__(
self._file_chooser.set_file(file, directory=directory)
self._set_file(None)

# Save the source location settings
self.source_locations.savebuttonbar.bn_save.click()

self._make_observers()

def _init(self):
"""
Handles aspects of initialization that need to be deferred until
a file is chosen.
"""
self.ccd, self.vsx = set_up(
self._file_chooser.path.name,
directory_with_images=self._file_chooser.path.parent,
)
# Read in the ccd data here and load the image into viewer instead of doing
# it behind the scenes in set_up and make_markers
self.ccd = self.fits_file.ccd
self.fits_file.load_in_image_widget(self.iw)

self.vsx = set_up(self.ccd)

apass, vsx_apass_angle, targets_apass_angle = crossmatch_APASS2VSX(
self.ccd, self.targets_from_file, self.vsx
Expand All @@ -310,13 +311,16 @@ def _init(self):

make_markers(
self.iw,
self.ccd,
self.targets_from_file,
self.vsx,
apass_comps,
name_or_coord=self.target_coord,
)

@property
def fits_file(self):
return self._file_chooser

@property
def photom_apertures_file(self):
return self.source_locations.value["source_list_file"]
Expand Down Expand Up @@ -349,7 +353,6 @@ def _set_object(self):
self.object_name.value = "<h2>Object unknown</h2>"
self._object = ""

print(f"Object: {self._object}")
# We have a name, try to get coordinates from it
try:
self.target_coord = SkyCoord.from_name(self._object)
Expand Down
Loading