Skip to content

Commit

Permalink
Upgrade to v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
radicamc committed Nov 28, 2023
1 parent 48c6fc9 commit 8f77f29
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
26 changes: 17 additions & 9 deletions applesoss/edgetrigger_centroids.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,24 @@ def get_centroids_edgetrigger(image, header=None, mask=None, poly_order=11,
if mask is None:
mask = np.zeros_like(image, dtype='bool')

# Call the script that determines the dimensions of the image.
result = get_image_dim(image, header=header, verbose=verbose)
dimx, dimy, xos, yos, xnative, ynative, padding, refpix_mask = result

# Replace masked pixel values with NaNs.
image_masked = np.where(mask | ~refpix_mask, np.nan, image)
try:
# Call the script that determines the dimensions of the image -- SOSS
# specific code.
result = get_image_dim(image, header=header, verbose=verbose)
dimx, dimy, xos, yos, xnative, ynative, padding, refpix_mask = result
# Replace masked pixel values with NaNs.
image_masked = np.where(mask | ~refpix_mask, np.nan, image)
# Use edge trigger to compute the edges and center of the trace.
fkwargs = dict(halfwidth=halfwidth, yos=yos, verbose=verbose,
outdir=outdir)
except ValueError:
# Will work for any data frame.
dimy, dimx = np.shape(image)
image_masked = image
# Use edge trigger to compute the edges and center of the trace.
fkwargs = dict(halfwidth=halfwidth, yos=1, verbose=verbose,
outdir=outdir)

# Use edge trigger to compute the edges and center of the trace.
fkwargs = dict(halfwidth=halfwidth, yos=yos, verbose=verbose,
outdir=outdir)
edge_outs = edge_trigger(image_masked, **fkwargs)
ytrace_max, ytrace_min, ytrace_best, widths_best = edge_outs

Expand Down
2 changes: 2 additions & 0 deletions applesoss/edgetrigger_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def _poly_res(p, x, y):
"""
return np.polyval(p, x) - y

ii = np.where(np.isfinite(y))
x, y = x[ii], y[ii]
mask = np.ones_like(x, dtype='bool')
for niter in range(maxiter):

Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

### [2.1.0] -- 2023-11-28
#### Added
- Edits to edgetrigger functions to allow its use for non-SOSS data.

### [2.0.2] -- 2023-07-24
#### Added
- Streamline installation process.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup

setup(name='applesoss',
version='2.0.2',
version='2.1.0',
license='MIT',
author='Michael Radica',
author_email='michael.radica@umontreal.ca',
Expand Down

0 comments on commit 8f77f29

Please sign in to comment.