Skip to content

Commit 3f11916

Browse files
committed
Fix bugs in get_source_visibility
- The source variable was not updated after the transform_to(self._gcrs) call (is not an inplace operation) - ez_cart was not normalized before taking the dot product to compare to the cos(angle) Signed-off-by: Israel Martinez <imc@umd.edu>
1 parent 3c4cee4 commit 3f11916

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cosipy/spacecraftfile/spacecraft_file.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ def _get_earth_occ(self, src_vec):
934934
# Simplify this calculation to avoid arcsin/cos.
935935
min_angle_cos = -np.sqrt(1 - sin_earth_angle**2)
936936
ez_cart = self._gcrs.cartesian.xyz.value
937+
ez_cart /= np.linalg.norm(ez_cart, axis=0)
937938

938939
if self._cache_earth_occ:
939940
# cache intermediates in case we need to use them
@@ -992,7 +993,7 @@ def get_source_visibility(self,
992993

993994
if source is not None:
994995
if isinstance(source, SkyCoord):
995-
source.transform_to(self._gcrs)
996+
source = source.transform_to(self._gcrs)
996997
source = source.cartesian.xyz.value
997998

998999
# get pointings that are occluded by Earth

0 commit comments

Comments
 (0)