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

Typos and other cleanup #90

Merged
merged 21 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fb479ce
Allow for personal docs that are not git repoed.
May 24, 2023
cb897dd
Fixed some typos I noticed, fixed documentation to be for stellarphot…
May 24, 2023
2786888
Add import of aij_rel_fluxes source to differential_photometry
May 24, 2023
b7e91ee
Removed old __all__ function in seeing_profile_functions and added Se…
May 24, 2023
6eb9a2b
Removed reference to glowing_waffles from documentation.
May 24, 2023
44a8510
Purge unused coordinates code and testing code for it.
JuanCab May 26, 2023
8215ee0
Fixed typos and added functions and classes to __all__ list in some s…
JuanCab May 26, 2023
d25ea67
Merge branch 'typos_and_other_cleanup' of https://github.com/JuanCab/…
JuanCab May 26, 2023
6d128fd
Merge branches.
JuanCab May 26, 2023
b601d77
Removed the need for coordinates code, only used once in photometry.py
JuanCab May 26, 2023
7e7deb1
Fixed doc building to include additional parameters.
JuanCab May 26, 2023
41482e9
Removed deprecated import of coordinates.
JuanCab May 26, 2023
05b7cf4
Added analysis package to docs and import.
JuanCab May 26, 2023
aafc873
Fixed mentions of dtype np.bool and replaced with bool, since that al…
JuanCab May 26, 2023
80e1f04
Fixed np.float to be float since that alias removed from recent numpy.
JuanCab May 26, 2023
eafac9b
Fixed references to np.int and used int, since that alias removed fro…
JuanCab May 26, 2023
2f3cde9
Update stellarphot/differential_photometry/__init__.py
JuanCab May 30, 2023
94fc2c4
Update stellarphot/analysis/__init__.py
JuanCab May 30, 2023
4633d67
Update stellarphot/visualization/fits_opener.py
JuanCab May 30, 2023
7e1ae83
Added extra blank line before function defintion for PEP8 compliance.
JuanCab May 30, 2023
37c7330
Merge branch 'main' into typos_and_other_cleanup
JuanCab May 30, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ distribute-*.tar.gz
.pydevproject
.settings
.vscode
_personal_docs

# Mac OSX
.DS_Store
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@


html_theme_options = {
'logotext1': 'glowing-waffles', # white, semi-bold
'logotext1': 'stellarphot', # white, semi-bold
'logotext2': '', # orange, light
'logotext3': ':docs' # white, light
}
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Documentation
=============

This is the documentation for glowing-waffles.
This is the documentation for stellarphot.
This is a package for doing stellar photometry that relies on astropy.

.. toctree::
Expand All @@ -11,5 +11,5 @@ This is a package for doing stellar photometry that relies on astropy.

.. note:: The layout of this directory is simply a suggestion. To follow
traditional practice, do *not* edit this page, but instead place
all documentation for the package inside ``glowing_waffles/``.
all documentation for the package inside ``stellarphot/``.
You can follow this practice or choose your own layout.
3 changes: 3 additions & 0 deletions docs/stellarphot/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Reference/API
=============

.. automodapi:: stellarphot
.. automodapi:: stellarphot.analysis
.. automodapi:: stellarphot.core
.. automodapi:: stellarphot.photometry
.. automodapi:: stellarphot.differential_photometry
.. automodapi:: stellarphot.source_detection
.. automodapi:: stellarphot.visualization
.. automodapi:: stellarphot.io
2 changes: 2 additions & 0 deletions stellarphot/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .exotic import *
from .transit_fitting import *
JuanCab marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 6 additions & 1 deletion stellarphot/analysis/exotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
from astropy.utils.data import get_pkg_data_filename


__all__ = ['MyValid', 'get_tic_info', 'make_checker','validate_exposure_time',
'populate_TIC_boxes', 'populate_TOI_boxes', 'exotic_settings_widget',
'set_values_from_json_file', 'get_values_from_widget','generate_json_file_name']


template_types = ['known', 'candidate']
template_json = {}
to_fill = {}
Expand Down Expand Up @@ -71,7 +76,7 @@ def get_tic_info(TIC_ID):

def make_checker(indicator_widget, value_widget):
"""
Build an observer thatchecks TIC number and, if it is a valid
Build an observer that checks TIC number and, if it is a valid
TIC number, looks up information about the TIC object from
MAST copy of TIC as priors for EXOTIC. It also sets the visible checkbox
to the appropriate state.
Expand Down
1 change: 1 addition & 0 deletions stellarphot/analysis/transit_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'or\n'
'pip install batman-package')

__all__ = ['VariableArgsFitter', 'TransitModelFit']

class VariableArgsFitter(LevMarLSQFitter):
"""
Expand Down
40 changes: 0 additions & 40 deletions stellarphot/coordinates.py

This file was deleted.

1 change: 1 addition & 0 deletions stellarphot/differential_photometry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .magnitude_transforms import *
from .catalog_search import *
from .vsx_mags import *
from .aij_rel_fluxes import *
JuanCab marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions stellarphot/differential_photometry/catalog_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def catalog_search(frame_wcs_or_center, shape, desired_catalog,
if clip_by_frame:
in_fov = in_frame(frame_wcs_or_center, cat_coords, padding=padding)
else:
in_fov = np.ones([len(cat_coords)], dtype=np.bool)
in_fov = np.ones([len(cat_coords)], dtype=bool)
return cat[in_fov]


Expand Down Expand Up @@ -131,7 +131,7 @@ def catalog_clean(catalog, remove_rows_with_mask=True,
}

recognized_comparison_ops = '|'.join(comparisons.keys())
keepers = np.ones([len(catalog)], dtype=np.bool)
keepers = np.ones([len(catalog)], dtype=bool)

if remove_rows_with_mask and catalog.masked:
for c in catalog.columns:
Expand All @@ -146,7 +146,7 @@ def catalog_clean(catalog, remove_rows_with_mask=True,
comparison_func = comparisons[results.group(1)]
comparison_value = results.group(2)
new_keepers = comparison_func(catalog[column],
np.float(comparison_value))
float(comparison_value))
keepers = keepers & new_keepers

return catalog[keepers]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def generate_star_coordinates(n_stars,
"""
# The plus one guarantees we'll have enough positions for
# all of our stars.
max_index = np.int(np.sqrt(n_stars)) + 1
max_index = int(np.sqrt(n_stars)) + 1

grids = np.mgrid[:max_index, :max_index]
dec_grid, ra_grid = grids
Expand Down
2 changes: 1 addition & 1 deletion stellarphot/io/aij.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np

__all__ = ['parse_aij_table', 'ApertureFileAIJ']
__all__ = ['parse_aij_table', 'ApertureAIJ', 'ApertureFileAIJ', 'MultiApertureAIJ', 'Star', 'generate_aij_table']


class ApertureAIJ:
Expand Down
8 changes: 4 additions & 4 deletions stellarphot/notebooks/example_interactive_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
" # that the event.x is a number from 0 to 1 covering the whole drawing \n",
" # canvas, but event.xdata is the position indicated in the units \n",
" # on the axes.\n",
" click_x_data = np.int(event.xdata)\n",
" click_y_data = np.int(event.ydata)\n",
" click_x_data = int(event.xdata)\n",
" click_y_data = int(event.ydata)\n",
" \n",
" # Define a slice centered on the click\n",
" slice_x = slice(click_x_data - stamp_size/2, click_x_data + stamp_size/2)\n",
Expand Down Expand Up @@ -202,8 +202,8 @@
"def mouse_moved(event):\n",
" # Yuck. This code duplicates the click stuff above.\n",
" stamp_size = 20\n",
" click_x_data = np.int(event.xdata)\n",
" click_y_data = np.int(event.ydata)\n",
" click_x_data = int(event.xdata)\n",
" click_y_data = int(event.ydata)\n",
" slice_x = slice(click_x_data-stamp_size/2, click_x_data+stamp_size/2)\n",
" slice_y = slice(click_y_data-stamp_size/2, click_y_data+stamp_size/2)\n",
" cutout = image_cut[slice_y, slice_x]\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"metadata": {},
"outputs": [],
"source": [
"cycle_number = np.int((then - epoch) / period + 1)\n",
"cycle_number = int((then - epoch) / period + 1)\n",
"that_transit = cycle_number * period + epoch\n",
"that_transit"
]
Expand Down
9 changes: 4 additions & 5 deletions stellarphot/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from astropy.stats import sigma_clipped_stats
from astropy.nddata import NoOverlapError

from .coordinates import convert_pixel_wcs
from .source_detection import compute_fwhm

__all__ = ['photutils_stellar_photometry',
Expand Down Expand Up @@ -122,7 +121,7 @@ def photutils_stellar_photometry(ccd_image, sources,

# Obtain RA/Dec coordinates and add them to table
try:
ra, dec = convert_pixel_wcs(ccd_image, coords[0], coords[1], 1)
ra, dec = ccd_image.wcs.all_pix2world(coords[0], coords[1], 0)
phot_table['RA_center'] = ra
phot_table['Dec_center'] = dec
except AttributeError:
Expand Down Expand Up @@ -339,7 +338,7 @@ def add_to_photometry_table(phot, ccd, annulus, apertures, fname='',
phot['date-obs'] = [ccd.header['DATE-OBS']] * len(phot)
night = Time(ccd.header['DATE-OBS'], scale='utc')
night.format = 'mjd'
phot['night'] = np.int(np.floor(night.value - 0.5))
phot['night'] = int(np.floor(night.value - 0.5))
phot['aperture_net_flux'] = (phot['aperture_sum'] -
(phot['aperture_area'] *
phot['sky_per_pix_avg']))
Expand Down Expand Up @@ -593,7 +592,7 @@ def find_times(phot_column, exposure,
ra=331.1170417, dec=81.5659444,
latitude=46.86678, longitude=263.54672):
"""
Returns a numpy array of barycentric julien date times
Returns a numpy array of barycentric Julian date times
JuanCab marked this conversation as resolved.
Show resolved Hide resolved

Parameters
----------
Expand Down Expand Up @@ -621,7 +620,7 @@ def find_times(phot_column, exposure,
-------

new_time : numpy array
array of barycentric times by julien date
array of barycentric times by Julian date

"""
location = EarthLocation(lat=latitude, lon=longitude)
Expand Down
1 change: 0 additions & 1 deletion stellarphot/source_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

__all__ = ['source_detection', 'compute_fwhm']


JuanCab marked this conversation as resolved.
Show resolved Hide resolved
def _fit_2dgaussian(data):
"""
Fit a 2d Gaussian to data.
Expand Down
25 changes: 0 additions & 25 deletions stellarphot/tests/test_coordinates.py

This file was deleted.

2 changes: 1 addition & 1 deletion stellarphot/tests/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_aperture_photometry_with_outlier_rejection(reject):
# adding these moves the average pixel value by quite a bit,
# so we'll only get the correct net flux if these are removed.
for source in fake_image.sources:
center_px = (np.int(source['x_mean']), np.int(source['y_mean']))
center_px = (int(source['x_mean']), int(source['y_mean']))
begin = center_px[0] + inner_annulus + 1
end = begin + (outer_annulus - inner_annulus - 1)
# Yes, x and y are deliberately reversed below.
Expand Down
4 changes: 0 additions & 4 deletions stellarphot/utils/__init__.py

This file was deleted.

5 changes: 5 additions & 0 deletions stellarphot/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@

from .multi_night_plots import *
from .aij_plots import *
from .comparison_functions import *
from .fits_opener import *
from .photometry_widget_functions import *
from .seeing_profile_functions import *
from .transit_plots import *
2 changes: 1 addition & 1 deletion stellarphot/visualization/comparison_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


__all__ = ['read_file', 'set_up', 'match', 'mag_scale',
'in_field', 'make_markers', 'wrap']
'in_field', 'make_markers', 'wrap', 'ComparisonViewer']

DESC_STYLE = {"description_width": "initial"}

Expand Down
2 changes: 2 additions & 0 deletions stellarphot/visualization/fits_opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from ipyfilechooser import FileChooser


__all__ = ['FitsOpener']

JuanCab marked this conversation as resolved.
Show resolved Hide resolved
class FitsOpener:
def __init__(self, title="Choose an image", filter_pattern=None, **kwargs):
self._fc = FileChooser(title=title, **kwargs)
Expand Down
3 changes: 3 additions & 0 deletions stellarphot/visualization/photometry_widget_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from ipyfilechooser import FileChooser


__all__ = ['PhotometrySettings']


class PhotometrySettings:
def __init__(self):
self._image_dir = FileChooser(title="Choose folder with images", show_only_dirs=True)
Expand Down
4 changes: 2 additions & 2 deletions stellarphot/visualization/seeing_profile_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from stellarphot.visualization import seeing_plot
from stellarphot.visualization.fits_opener import FitsOpener

__all__ = ['set_keybindings', 'box', 'make_show_event']
__all__ = ['set_keybindings', 'box', 'SeeingProfileWidget']

desc_style = {"description_width": "initial"}

Expand Down Expand Up @@ -176,7 +176,7 @@ def radial_profile(data, center, size=30, return_scaled=True):

r = np.sqrt((xd - sub_center[0])**2 + (yd - sub_center[1])**2)
r_exact = r.copy()
r = r.astype(np.int)
r = r.astype(int)

sub_data = sub_image.data

Expand Down
3 changes: 3 additions & 0 deletions stellarphot/visualization/transit_plots.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import numpy as np


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


def plot_many_factors(photometry, low, high, shift, scale):
airmass = photometry['airmass'] / np.mean(photometry['airmass'])
x = photometry['xcenter'] / np.mean(photometry['xcenter'])
Expand Down