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

Add isort #250

Merged
merged 2 commits into from
Jan 9, 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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ c47587cbfa829b03be1dc2e5a79dc96af6ea712f
855f1d409a0eaf407e55d0d39a7ee195c19612a3
# Ignore whitespace changes in comments/docstrings
1b7139d4e9db54c818293832e89aaca30b662a32
# Ignore initial isort
479a2cdb25baa7f40cc73b1f5999e0b61c4d69ed
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# Thus, any C-extensions that are needed to build the documentation will *not*
# be accessible, and the documentation will not build correctly.

import sys
import datetime
import sys
from importlib import import_module
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ select = [
"UP",
# check for numpy deprecations
"NPY",
"I", # isort checks
]
[tool.ruff.lint.per-file-ignores]
# Ignore `E402` and `F403` (import violations) in all `__init__.py` files.
Expand Down
11 changes: 4 additions & 7 deletions stellarphot/core.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import re

import numpy as np
import pandas as pd
from astropy import units as u
from astropy.coordinates import EarthLocation, SkyCoord
from astropy.io.misc.yaml import AstropyDumper, AstropyLoader
from astropy.table import Column, QTable, Table, TableAttribute
from astropy.time import Time
from astropy.units import Quantity, Unit, IrreducibleUnit
from astropy.units import IrreducibleUnit, Quantity, Unit
from astropy.wcs import WCS

from astroquery.vizier import Vizier

import pandas as pd
from pydantic import BaseModel, root_validator, Field, validator

import numpy as np
from pydantic import BaseModel, Field, root_validator, validator

__all__ = [
"Camera",
Expand Down
3 changes: 1 addition & 2 deletions stellarphot/differential_photometry/aij_rel_fluxes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import astropy.units as u
import numpy as np

from astropy.coordinates import SkyCoord
from astropy.table import Table
import astropy.units as u

__all__ = ["add_in_quadrature", "calc_aij_relative_flux"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import astropy.units as u
import numpy as np

import pytest

from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.time import Time
import astropy.units as u

from stellarphot import PhotometryData
from stellarphot.differential_photometry.aij_rel_fluxes import calc_aij_relative_flux
Expand Down
5 changes: 3 additions & 2 deletions stellarphot/differential_photometry/tests/test_vsx_mags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from astropy.table import Table, vstack
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.table import Table, vstack
from astropy.utils.data import get_pkg_data_filename
import numpy as np

from .. import calc_multi_vmag, calc_vmag


Expand Down
5 changes: 2 additions & 3 deletions stellarphot/differential_photometry/vsx_mags.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import numpy as np

from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table

__all__ = ["calc_multi_vmag", "calc_vmag"]

Expand Down
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 .fits_opener import *
from .comparison_functions import *
from .fits_opener import *
from .photometry_widget_functions import *
from .seeing_profile_functions import *
16 changes: 6 additions & 10 deletions stellarphot/gui_tools/comparison_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@
from pathlib import Path

import ipywidgets as ipw

import numpy as np

from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.coordinates.name_resolve import NameResolveError

from astropy.table import Table

try:
from astrowidgets import ImageWidget
except ImportError:
from astrowidgets.ginga import ImageWidget

from stellarphot import SourceListData
from stellarphot.gui_tools.seeing_profile_functions import set_keybindings
from stellarphot.gui_tools.fits_opener import FitsOpener
from stellarphot.io import TessSubmission, TOI, TessTargetFile
from stellarphot.gui_tools.seeing_profile_functions import set_keybindings
from stellarphot.io import TOI, TessSubmission, TessTargetFile
from stellarphot.utils.comparison_utils import (
set_up,
crossmatch_APASS2VSX,
mag_scale,
in_field,
mag_scale,
set_up,
)


__all__ = ["make_markers", "wrap", "ComparisonViewer"]

DESC_STYLE = {"description_width": "initial"}
Expand Down
4 changes: 1 addition & 3 deletions stellarphot/gui_tools/fits_opener.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from pathlib import Path
import warnings
from pathlib import Path

from astropy.io import fits
from astropy.nddata import CCDData

from ipyfilechooser import FileChooser


__all__ = ["FitsOpener"]


Expand Down
2 changes: 1 addition & 1 deletion stellarphot/gui_tools/photometry_widget_functions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

from ccdproc import ImageFileCollection
import ipywidgets as ipw
from ccdproc import ImageFileCollection

from stellarphot.settings import ApertureSettings, PhotometryFileSettings, ui_generator

Expand Down
7 changes: 3 additions & 4 deletions stellarphot/gui_tools/seeing_profile_functions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from pathlib import Path
import warnings
from pathlib import Path

import numpy as np
import ipywidgets as ipw

import numpy as np
from astropy.io import fits
from astropy.table import Table

Expand All @@ -14,8 +13,8 @@

import matplotlib.pyplot as plt

from stellarphot.io import TessSubmission
from stellarphot.gui_tools.fits_opener import FitsOpener
from stellarphot.io import TessSubmission
from stellarphot.photometry import CenterAndProfile
from stellarphot.photometry.photometry import EXPOSURE_KEYWORDS
from stellarphot.plotting import seeing_plot
Expand Down
5 changes: 2 additions & 3 deletions stellarphot/io/aij.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from pathlib import Path
import re
from pathlib import Path

import astropy.units as u
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.table import Table

import numpy as np

__all__ = [
"ApertureAIJ",
"MultiApertureAIJ",
Expand Down
7 changes: 3 additions & 4 deletions stellarphot/io/tess.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import re
from dataclasses import dataclass
from pathlib import Path
import re
from tempfile import NamedTemporaryFile

import requests
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.time import Time
from astropy import units as u
from astropy.utils.data import download_file

import requests

from stellarphot.transit_fitting.io import get_tic_info

__all__ = ["TessSubmission", "TOI", "TessTargetFile"]
Expand Down
1 change: 0 additions & 1 deletion stellarphot/io/tests/test_aij_io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np

from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.utils.data import get_pkg_data_filename
Expand Down
2 changes: 1 addition & 1 deletion stellarphot/io/tests/test_tess_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import warnings

import pytest

from astropy.coordinates import SkyCoord

from stellarphot.io.tess import TessSubmission, TessTargetFile

GOOD_HEADER = {
Expand Down
6 changes: 2 additions & 4 deletions stellarphot/photometry/photometry.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import warnings
import logging
import warnings
from pathlib import Path

import bottleneck as bn
import numpy as np
from pathlib import Path

from astropy import units as u
from astropy.coordinates import EarthLocation, SkyCoord
from astropy.nddata import CCDData, NoOverlapError
Expand All @@ -15,7 +14,6 @@
from ccdproc import ImageFileCollection
from photutils.aperture import CircularAnnulus, CircularAperture, aperture_photometry
from photutils.centroids import centroid_sources

from scipy.spatial.distance import cdist

from stellarphot import Camera, PhotometryData, SourceListData
Expand Down
7 changes: 3 additions & 4 deletions stellarphot/photometry/profiles.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import warnings

import numpy as np
from astropy.stats import sigma_clipped_stats
from astropy.nddata import Cutout2D
from astropy.nddata.utils import NoOverlapError
from astropy.stats import sigma_clipped_stats
from astropy.utils import lazyproperty

from photutils.profiles import RadialProfile, CurveOfGrowth
from photutils.centroids import centroid_com, centroid_2dg
from photutils.centroids import centroid_2dg, centroid_com
from photutils.profiles import CurveOfGrowth, RadialProfile

from stellarphot.photometry import calculate_noise

Expand Down
10 changes: 4 additions & 6 deletions stellarphot/photometry/tests/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import numpy as np
import pytest

from astropy.table import QTable
from astropy.stats import gaussian_sigma_to_fwhm
from astropy import units as u
from astropy.stats import gaussian_sigma_to_fwhm
from astropy.table import QTable
from astropy.utils.exceptions import AstropyUserWarning

from stellarphot.photometry import source_detection, compute_fwhm

from fake_image import FakeImage

from stellarphot.photometry import compute_fwhm, source_detection

# Make sure the tests are deterministic by using a random seed
SEED = 5432985

Expand Down
3 changes: 1 addition & 2 deletions stellarphot/photometry/tests/test_photometry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tempfile
from pathlib import Path
import warnings
from pathlib import Path

import numpy as np
import pytest
Expand All @@ -9,7 +9,6 @@
from astropy.io import ascii
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.metadata.exceptions import MergeConflictWarning

from fake_image import FakeCCDImage, shift_FakeCCDImage

from stellarphot.core import Camera, SourceListData
Expand Down
5 changes: 1 addition & 4 deletions stellarphot/photometry/tests/test_profiles.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import numpy as np

import pytest

from astropy.table import Table

from photutils.datasets import make_gaussian_sources_image, make_noise_image

from stellarphot import Camera
from stellarphot.photometry import find_center, CenterAndProfile
from stellarphot.photometry import CenterAndProfile, find_center
from stellarphot.tests.test_core import TEST_CAMERA_VALUES

# Make a few round stars
Expand Down
2 changes: 1 addition & 1 deletion stellarphot/plotting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

from .multi_night_plots import *
from .aij_plots import *
from .multi_night_plots import *
from .transit_plots import *
5 changes: 1 addition & 4 deletions stellarphot/plotting/multi_night_plots.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

from astropy.stats import mad_std
from astropy.time import Time

from astropy.timeseries import LombScargle


__all__ = ["plot_magnitudes", "multi_night"]


Expand Down
5 changes: 1 addition & 4 deletions stellarphot/plotting/transit_plots.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from matplotlib import pyplot as plt

import numpy as np

from astropy import units as u

from matplotlib import pyplot as plt

__all__ = ["plot_many_factors", "bin_data", "scale_and_shift"]

Expand Down
11 changes: 4 additions & 7 deletions stellarphot/settings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

from pathlib import Path

from pydantic import BaseModel, Field, conint, validator

from .autowidgets import CustomBoundedIntTex

from astropy.time import Time
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
from astropy.units import Quantity
import astropy.units as u
from pydantic import BaseModel, Field, conint, validator

from ..core import QuantityType

from .autowidgets import CustomBoundedIntTex

__all__ = ["ApertureSettings", "PhotometryFileSettings", "Exoplanet"]

Expand Down
7 changes: 3 additions & 4 deletions stellarphot/settings/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import astropy.units as u
import pytest
from astropy.coordinates import SkyCoord
from astropy.time import Time
from pydantic import ValidationError
import pytest

from stellarphot.settings.models import ApertureSettings, Exoplanet

from astropy.coordinates import SkyCoord
import astropy.units as u

DEFAULT_APERTURE_SETTINGS = dict(radius=5, gap=10, annulus_width=15)


Expand Down
Loading