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

Add Static Source checks and NEOS Individual Chips #30

Merged
merged 13 commits into from
May 28, 2024
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]

### Added

- Added support for NEOS Visit FOVs, which are joint FOVs containing 4 rectangles.
- Added python interface to WISE Color Correction functions.
- Added support for querying static sky sources in FOVs.

### Changed

- Restructured the Rust FOVs to be organized by observatory.

## [0.2.2] - 2024 - 5 - 20

### Added
Expand Down Expand Up @@ -72,6 +84,7 @@ Initial Release
Along with many helpful interfaces to web tools such as JPL Horizons or IPAC's IRSA.


[0.2.2]: https://github.com/IPAC-SW/neospy/tree/main
[Unreleased]: https://github.com/IPAC-SW/neospy/tree/main
[0.2.2]: https://github.com/IPAC-SW/neospy/releases/tag/v0.2.2
[0.2.1]: https://github.com/IPAC-SW/neospy/releases/tag/v0.2.1
[0.2.0]: https://github.com/IPAC-SW/neospy/releases/tag/v0.2.0
4 changes: 4 additions & 0 deletions src/neospy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
propagate_n_body,
propagate_two_body,
moid,
spice_visible,
state_visible,
)
from .time import Time
from .conversion import (
Expand Down Expand Up @@ -66,6 +68,8 @@
"compute_diameter",
"compute_semi_major",
"compute_aphelion",
"spice_visible",
"state_visible",
"mag_to_flux",
"flux_to_mag",
"Vector",
Expand Down
13 changes: 12 additions & 1 deletion src/neospy/fov.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# pylint: disable-next=import-error
from ._core import ( # type: ignore
NeosCmos,
NeosVisit,
WiseCmos,
ZtfCcdQuad,
ZtfField,
RectangleFOV,
FOVList,
fov_static_checks,
)


__all__ = ["NeosCmos", "WiseCmos", "ZtfCcdQuad", "ZtfField", "RectangleFOV", "FOVList"]
__all__ = [
"NeosCmos",
"NeosVisit",
"WiseCmos",
"ZtfCcdQuad",
"ZtfField",
"RectangleFOV",
"FOVList",
"fov_static_checks",
]
20 changes: 12 additions & 8 deletions src/neospy/rust/flux/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,28 +472,32 @@ pub fn wise_frm_flux_py(
.collect()
}

/// Calculate the W1 black body color correction for the given temperature in kelvin.
#[pyfunction]
#[pyo3(name = "w1_color_correction")]
pub fn w1_color_correction_py(temps: f64) -> f64 {
w1_color_correction(temps)
pub fn w1_color_correction_py(temp: f64) -> f64 {
w1_color_correction(temp)
}

/// Calculate the W2 black body color correction for the given temperature in kelvin.
#[pyfunction]
#[pyo3(name = "w2_color_correction")]
pub fn w2_color_correction_py(temps: f64) -> f64 {
w2_color_correction(temps)
pub fn w2_color_correction_py(temp: f64) -> f64 {
w2_color_correction(temp)
}

/// Calculate the W3 black body color correction for the given temperature in kelvin.
#[pyfunction]
#[pyo3(name = "w3_color_correction")]
pub fn w3_color_correction_py(temps: f64) -> f64 {
w3_color_correction(temps)
pub fn w3_color_correction_py(temp: f64) -> f64 {
w3_color_correction(temp)
}

/// Calculate the W4 black body color correction for the given temperature in kelvin.
#[pyfunction]
#[pyo3(name = "w4_color_correction")]
pub fn w4_color_correction_py(temps: f64) -> f64 {
w4_color_correction(temps)
pub fn w4_color_correction_py(temp: f64) -> f64 {
w4_color_correction(temp)
}

#[pyfunction]
Expand Down
43 changes: 42 additions & 1 deletion src/neospy/rust/fovs/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use neospy_core::propagation::propagate_n_body_spk;
use pyo3::prelude::*;
use rayon::prelude::*;

use crate::simult_states::{PySimultaneousStates, SimulStateLike};
use crate::{simult_states::{PySimultaneousStates, SimulStateLike}, vector::{Vector, VectorLike}};

#[pyfunction]
#[pyo3(name = "fov_checks")]
Expand Down Expand Up @@ -79,3 +79,44 @@ pub fn fov_spk_checks_py(obj_ids: Vec<isize>, fovs: FOVListLike) -> Vec<PySimult
.flatten()
.collect()
}


/// Check if a list of static sky positions are present in the given Field of View list.
///
/// This returns a list of tuples, where the first entry in the tuple is the vector of
/// all of the points in the provided FOV, and the second entry is the original FOV.
///
/// Parameters
/// ----------
/// pos :
/// Collection of Vectors defining sky positions from the point of view of the observer.
/// These vectors are automatically converted to the Ecliptic frame, results will be
/// returned in that frame as well.
/// fovs :
/// Collection of Field of Views to check.
#[pyfunction]
#[pyo3(name = "fov_static_checks")]
pub fn fov_static_checks_py(pos: Vec<VectorLike>, fovs: FOVListLike) -> Vec<(Vec<Vector>, AllowedFOV)> {
let fovs = fovs.into_sorted_vec_fov();
let pos:Vec<_> = pos.into_iter().map(|p| p.into_vec(crate::frame::PyFrames::Ecliptic)).collect();

fovs.into_par_iter()
.filter_map(|fov| {
let vis: Vec<_> = fov
.check_statics(&pos)
.into_iter()
.filter_map(|pop| {
pop.map(|(p_vec, fov)| {
let p_vec = p_vec.into_iter().map(|p| Vector::new(p.into(), crate::frame::PyFrames::Ecliptic)).collect();
(p_vec, fov.into())
})
})
.collect();
match vis.is_empty() {
true => None,
false => Some(vis),
}
})
.flatten()
.collect()
}
1 change: 1 addition & 0 deletions src/neospy/rust/fovs/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub enum FOVListLike {

impl FOVListLike {
/// Convert to a vector of neospy core fovs.
/// Frames will always be ecliptic
pub fn into_sorted_vec_fov(self) -> Vec<neospy_core::fov::FOV> {
let mut fovs = match self {
FOVListLike::Vec(v) => v,
Expand Down
Loading
Loading