Skip to content

Commit

Permalink
Add .jd() to all python FOVs
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlend committed Sep 20, 2024
1 parent b2882e5 commit c0913c0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `kete.conversion.bin_data`, which allows for binning matrix data such as images.
- Added tutorial showing precovery of an asteroid from a 1950's glass plate observation
done at the Palomar Observatory.
- Added sunshield rotation calculation for NEO Surveyor.
- Added sun-shield rotation calculation for NEO Surveyor.
- All FOV's now have the `.jd()` method which returns the JD of the observer state.

### Changed

Expand Down
49 changes: 49 additions & 0 deletions src/kete/rust/fovs/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ impl PyWiseCmos {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Direction that the observer is looking.
#[getter]
pub fn pointing(&self) -> Vector {
Expand Down Expand Up @@ -285,6 +291,12 @@ impl PyGenericRectangle {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Direction that the observer is looking.
#[getter]
pub fn pointing(&self) -> Vector {
Expand Down Expand Up @@ -346,6 +358,12 @@ impl PyGenericCone {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Direction that the observer is looking.
#[getter]
pub fn pointing(&self) -> Vector {
Expand Down Expand Up @@ -384,6 +402,12 @@ impl PyOmniDirectional {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

fn __repr__(&self) -> String {
format!("OmniDirectional(observer={})", self.observer().__repr__(),)
}
Expand Down Expand Up @@ -455,6 +479,12 @@ impl PyNeosCmos {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Direction that the observer is looking.
#[getter]
pub fn pointing(&self) -> Vector {
Expand Down Expand Up @@ -642,6 +672,12 @@ impl PyNeosVisit {
Vector::new(self.0.pointing().into(), self.0.observer().frame.into())
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Metadata about where this FOV is in the Survey.
#[getter]
pub fn side_id(&self) -> u16 {
Expand Down Expand Up @@ -777,11 +813,18 @@ impl PyZtfCcdQuad {
))
}

/// State of the observer for this FOV.
#[getter]
pub fn observer(&self) -> PyState {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Metadata about where this FOV is in the Survey.
#[getter]
pub fn field(&self) -> u32 {
Expand Down Expand Up @@ -886,6 +929,12 @@ impl PyZtfField {
self.0.observer().clone().into()
}

/// JD of the observer location.
#[getter]
pub fn jd(&self) -> f64 {
self.0.observer().jd
}

/// Metadata about where this FOV is in the Survey.
#[getter]
pub fn field(&self) -> u32 {
Expand Down
4 changes: 3 additions & 1 deletion src/kete/wise.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,9 @@ def fetch_WISE_fovs(phase):

corners = []
for i in range(4):
corners.append(Vector.from_ra_dec(row[f"w1ra{i+1}"], row[f"w1dec{i+1}"]))
corners.append(
Vector.from_ra_dec(row[f"w1ra{i + 1}"], row[f"w1dec{i + 1}"])
)

pointing = np.mean(corners, axis=0)
pointing = Vector(pointing, frame=Frames.Equatorial)
Expand Down

0 comments on commit c0913c0

Please sign in to comment.