Skip to content

Commit

Permalink
Address PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykubica committed Sep 27, 2023
1 parent 7110dcb commit e15a8ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 139 deletions.
8 changes: 4 additions & 4 deletions src/kbmod/analysis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def load_images(
-------
stack : `kbmod.ImageStack`
The stack of images loaded.
wcs_list : `astropy.wcs.WCS`
A list of `astropy.wcs.WCS` objects for each image.
wcs_list : `list`
A `list` of `astropy.wcs.WCS` objects for each image.
visit_times : list
A list of MJD times.
A `list` of MJD times.
"""
print("---------------------------------------")
print("Loading Images")
Expand Down Expand Up @@ -103,7 +103,7 @@ def load_images(
if "IDNUM" in hdu_list[0].header:
visit_id = str(hdu_list[0].header["IDNUM"])
else:
name = full_file_path.rsplit("/")[-1]
name = os.path.split(full_file_path)[-1]
visit_id = FileUtils.visit_from_file_name(name)

# Skip files without a valid visit ID.
Expand Down
18 changes: 9 additions & 9 deletions src/kbmod/run_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def _count_known_matches(self, result_list, search):
print(matches_string)
print("-----------------")

def _calc_barycentric_corr(self, wcslist, mjds, x_size, y_size, dist):
def _calc_barycentric_corr(self, wcs_list, mjds, x_size, y_size, dist):
"""
This function calculates the barycentric corrections between
each image and the first.
Expand All @@ -396,7 +396,7 @@ def _calc_barycentric_corr(self, wcslist, mjds, x_size, y_size, dist):
Parameters
----------
wcslist : `astropy.wcs.WCS`
wcs_list : `astropy.wcs.WCS`
A list of `astropy.wcs.WCS` objects for each image.
mjds : list
A list of MJDs for each image.
Expand All @@ -421,7 +421,7 @@ def _calc_barycentric_corr(self, wcslist, mjds, x_size, y_size, dist):
xlist = xlist.flatten()
ylist = ylist.flatten()
obs_pos = obs_pos_list[0]
cobs = wcslist[0].pixel_to_world(xlist, ylist)
cobs = wcs_list[0].pixel_to_world(xlist, ylist)
cobs.representation_type = "cartesian"

# Calculate r for sky coordinate in cobs
Expand All @@ -431,7 +431,7 @@ def _calc_barycentric_corr(self, wcslist, mjds, x_size, y_size, dist):

cbary = astroCoords.SkyCoord(obs_pos + r * cobs.cartesian, representation_type="cartesian")

return self._calculate_barycoeff_list(xlist, ylist, wcslist, cbary, obs_pos_list)
return self._calculate_barycoeff_list(xlist, ylist, wcs_list, cbary, obs_pos_list)

def _observer_distance_calculation(self, bary_dist, obs_pos, cobs):
"""
Expand Down Expand Up @@ -465,19 +465,19 @@ def _observer_distance_calculation(self, bary_dist, obs_pos, cobs):
r = -dot + np.sqrt(bary_dist * bary_dist - r2_obs + dot * dot)
return r

def _calculate_barycoeff_list(self, xlist, ylist, wcslist, cbary, obs_pos_list):
def _calculate_barycoeff_list(self, xlist, ylist, wcs_list, cbary, obs_pos_list):
"""Function to calculate the least squares fit parameters for the barycentric correction.
Requires that cbary, obs_pos_list and wcslist are defined.
Requires that cbary, obs_pos_list and wcs_list are defined.
"""
baryCoeff = np.zeros((len(wcslist), 6))
baryCoeff = np.zeros((len(wcs_list), 6))
coefficients = np.stack([np.ones_like(xlist), xlist, ylist], axis=-1)
xylist = np.stack([xlist, ylist], axis=-1)
for i in range(1, len(wcslist)):
for i in range(1, len(wcs_list)):
# hold the barycentric coordinates constant and convert to new frame
# by subtracting the observer's new position and converting to RA/DEC and pixel
# [bary_to_obs_fast()]
baryCoeff[i, :] = self._least_squares_fit_parameters(
coefficients, xylist, wcslist[i], cbary, obs_pos_list[i]
coefficients, xylist, wcs_list[i], cbary, obs_pos_list[i]
)

return baryCoeff
Expand Down
126 changes: 0 additions & 126 deletions src/kbmod/search/stack_search_docs.h

This file was deleted.

0 comments on commit e15a8ec

Please sign in to comment.