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

Updated ruff and black precommit revs and added codespell to precommit. #366

Merged
merged 7 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,27 @@ repos:
# Per the ruff documentation, this should be before black
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.15
rev: v0.4.8
hooks:
# Run the linter.
- id: ruff
args: [--fix]


# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.4.2
hooks:
- id: black
# It is recommended to specify the latest version of Python
# supported by your project here, or alternatively use
# pre-commit's default_language_version, see
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.11

# per the documentation this should add codespell spell checking
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# A Python Package for Transforming Stellar Photometry

[![Powered by Astropy Badge](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org) [![GitHub Workflow badge](https://github.com/feder-observatory/stellarphot/workflows/Test/badge.svg?branch=main)](https://github.com/feder-observatory/stellarphot/actions?query=workflow%3ATest) [![codecov](https://codecov.io/gh/feder-observatory/stellarphot/graph/badge.svg?token=uVrdNencSQ)](https://codecov.io/gh/feder-observatory/stellarphot) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10679636.svg)](https://doi.org/10.5281/zenodo.10679636)
[![Powered by Astropy Badge](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org)
[![GitHub Workflow badge](https://github.com/feder-observatory/stellarphot/workflows/Test/badge.svg?branch=main)](https://github.com/feder-observatory/stellarphot/actions?query=workflow%3ATest)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/feder-observatory/stellarphot/main.svg)](https://results.pre-commit.ci/latest/github/feder-observatory/stellarphot/main)
[![codecov](https://codecov.io/gh/feder-observatory/stellarphot/graph/badge.svg?token=uVrdNencSQ)](https://codecov.io/gh/feder-observatory/stellarphot)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10679636.svg)](https://doi.org/10.5281/zenodo.10679636)

Stellarphot provides a Python package and accompanying Jupyter notebooks to allow you to turn reduced astronomical images of point sources (e.g. stars) into calibrated astronomical photometry, with a focus on variable star and exoplanet transit observations. Specifically:

- If you have reduced astronomical images as FITS files but haven't obtained photometry yet, `stellarphot` can perform aperture photometry on your images.
- If you already have aperture photometry for a field, `stellarphot` can
- If you already have aperture photometry for a field, `stellarphot` can
- calculate relative flux (like [AstroImageJ](https://www.astro.louisville.edu/software/astroimagej/)), and/or
- calculate calibrated magnitudes by transforming to a catalog (e.g. APASS DR9)
- If you are working with exoplanet transit observations, `stellarphot` can turns the photometry into exoplanet transit light curves (see installation notes below).
Expand All @@ -19,22 +23,22 @@ You can install `stellarphot` with either `pip` or `conda`. If you are interest
conda install -c conda-forge stellarphot reducer
pip install astronbs
```
If you are interested in exoplanet light curve fitting, also install `batman` using
If you are interested in exoplanet light curve fitting, also install `batman` using

```
conda install -c conda-forge batman-package
```

- Install with `pip` using
```
pip install stellarphot reducer astronbs
```
or if you are interested in exoplanet light curve fitting you should instead use:

```
pip install stellarphot[exo_fitting] reducer astronbs
```

## Getting started with stellarphot

1. Start Jupyterlab from the command line: `jupyter lab`
Expand All @@ -43,7 +47,7 @@ You can install `stellarphot` with either `pip` or `conda`. If you are interest

<img width="833" alt="stellarphot-screenshot" src="https://user-images.githubusercontent.com/1147167/200139186-100934ca-6d1e-46f9-ac89-a83d05528bb2.png">

## Questions?
## Questions?

Feel free to contact @mwcraig with your questions about using `stellarphot`.

Expand Down
1 change: 1 addition & 0 deletions ignore-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TOI
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ select = [
# Ignore F405 (variable may be from star imports) in docs/conf.py
"docs/conf.py" = ["F405"]

[tool.codespell]
skip = '*.svg'
ignore-words = "ignore-words.txt"

[tool.pytest.ini_options]
minversion = 7.0
testpaths = [
Expand Down
4 changes: 1 addition & 3 deletions stellarphot/photometry/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ def single_image_photometry(
f"'{type(photometry_options)}'."
)


# Set up logging
logfile = logging_options.logfile
console_log = logging_options.console_log
Expand All @@ -222,7 +221,7 @@ def single_image_photometry(
# from multi_image_photometry before creating new log file handler
# (Warning: This actually just catches if the logger has any handlers.
# Probably not the best way to do this.)
fh_exists = False # Default to filehandler not existing
fh_exists = False # Default to filehandler not existing
if logger.hasHandlers() is False:
logger.setLevel(logging.INFO)
# Set up logging to a file (in addition to any logging below)
Expand All @@ -245,7 +244,6 @@ def single_image_photometry(
ch.setLevel(logging.INFO)
logger.addHandler(ch)


#
# Check CCDData headers before proceeding
#
Expand Down
6 changes: 3 additions & 3 deletions stellarphot/photometry/tests/test_photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def test_logging_single_image(self, capsys, logfile, console_log, tmp_path):
source_locations.source_list_file = str(source_list_file)

# Define the logging settings
logging_settings=DEFAULT_LOGGING_SETTINGS.model_copy()
logging_settings = DEFAULT_LOGGING_SETTINGS.model_copy()
if logfile:
# Define the log file and console log settings
# and make sure to set full path of log file.
Expand Down Expand Up @@ -748,13 +748,13 @@ def test_logging_multiple_image(self, capsys, logfile, console_log):
)

# Define the logging settings
logging_settings=DEFAULT_LOGGING_SETTINGS.model_copy()
logging_settings = DEFAULT_LOGGING_SETTINGS.model_copy()
if logfile:
logging_settings.logfile = logfile
logging_settings.console_log = console_log
# log file should be written to image directory (tmp_dir)
# automtically, this ensures we know the path to the log file.
full_logfile = str(Path(temp_dir) / logfile)
full_logfile = str(Path(temp_dir) / logfile)
photometry_settings.logging_settings = logging_settings

with warnings.catch_warnings():
Expand Down