diff --git a/CHANGELOG.md b/CHANGELOG.md index 52ba03f..6567f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Comet Magnitude estimates now accepts two phase correction values instead of 1. +### Fixed + +- Fixed a text case-sensitivity but on Horizons parameter parsing. +- Thermal model example had function arguments out of order. + ## [v1.0.4] diff --git a/src/examples/plot_thermal_model.py b/src/examples/plot_thermal_model.py index 6f01d5f..f7a942d 100644 --- a/src/examples/plot_thermal_model.py +++ b/src/examples/plot_thermal_model.py @@ -35,12 +35,12 @@ # result is not used in this example. # Compute the temperature at the subsolar point on the object. -# Note that FRM uses a beaming = pi neatm_subsolar_temp = kete.flux.sub_solar_temperature( - -obj2sun, vis_albedo, g_phase, emissivity, beaming + -obj2sun, vis_albedo, g_phase, beaming, emissivity ) +# Note that FRM uses a beaming = pi frm_subsolar_temp = kete.flux.sub_solar_temperature( - -obj2sun, vis_albedo, g_phase, emissivity + -obj2sun, vis_albedo, g_phase, np.pi, emissivity ) # Compute the FRM and NEATM facet temperatures for the object @@ -60,7 +60,7 @@ plt.subplot(121, projection="3d") norm = mpl.colors.Normalize(vmin=0, vmax=max(neatm_facet_temps)) -m = cm.ScalarMappable(norm=norm, cmap=mpl.colormaps["RdBu_r"]) +m = cm.ScalarMappable(norm=norm, cmap=mpl.colormaps["inferno"]) colors = m.to_rgba(neatm_facet_temps, alpha=1) polygons = Poly3DCollection(geom.facets, edgecolor="black", lw=0.2, color=colors) plt.gca().add_collection3d(polygons) diff --git a/src/kete/horizons.py b/src/kete/horizons.py index 40924a8..cf9be27 100644 --- a/src/kete/horizons.py +++ b/src/kete/horizons.py @@ -143,7 +143,9 @@ def fetch(name, update_name=True, cache=True, update_cache=False, exact_name=Fal if "model_pars" in props["orbit"]: for param in props["orbit"]["model_pars"]: elements[param["name"]] = float(param["value"]) - params = [(lookup_rev.get(x, x), elements.get(x, np.nan)) for x in labels] + params = [ + (lookup_rev.get(x, x.lower()), elements.get(x, np.nan)) for x in labels + ] phys["covariance"] = Covariance(name, cov_epoch, params, mat) else: raise ValueError( @@ -466,7 +468,8 @@ def fetch_known_orbit_data(update_cache=False): res = requests.get( ( "https://ssd-api.jpl.nasa.gov/sbdb_query.api?fields=" - "pdes,spkid,orbit_id,rms,H,diameter,epoch,e,i,q,w,tp,om,A1,A2,A3,DT,M1,M2,K1,K2,PC,rot_per" + "pdes,spkid,orbit_id,rms,H,diameter,epoch,e,i,q,w,tp,om," + "A1,A2,A3,DT,M1,M2,K1,K2,PC,rot_per" "&full-prec=1&sb-xfrag=1" ), timeout=120, diff --git a/src/kete/neos.py b/src/kete/neos.py index acd2f77..fb85957 100644 --- a/src/kete/neos.py +++ b/src/kete/neos.py @@ -1,8 +1,7 @@ import numpy as np -from .fov import NeosCmos, NeosVisit -__all__ = ["sunshield_rotation", "NeosCmos", "NeosVisit", "FOV_WIDTH", "FOV_HEIGHT"] +__all__ = ["sunshield_rotation", "FOV_WIDTH", "FOV_HEIGHT"] BANDS: list[float] = [4700.0, 8000.0] diff --git a/src/kete/rust/flux/common.rs b/src/kete/rust/flux/common.rs index 65802bf..42a1425 100644 --- a/src/kete/rust/flux/common.rs +++ b/src/kete/rust/flux/common.rs @@ -84,15 +84,14 @@ pub fn solar_flux_py(dist: f64, wavelength: f64) -> PyResult { /// emissivity : /// Emissivity of the object, 0.9 by default. #[pyfunction] -#[pyo3(name = "sub_solar_temperature", signature = (obj2sun, geom_albedo, g_param, beaming, emissivity=None))] +#[pyo3(name = "sub_solar_temperature", signature = (obj2sun, geom_albedo, g_param, beaming, emissivity=0.9))] pub fn sub_solar_temperature_py( obj2sun: VectorLike, geom_albedo: f64, g_param: f64, beaming: f64, - emissivity: Option, + emissivity: f64, ) -> f64 { - let emissivity = emissivity.unwrap_or(0.9); let obj2sun = obj2sun.into_vec(PyFrames::Ecliptic); sub_solar_temperature(&obj2sun, geom_albedo, g_param, beaming, emissivity) } @@ -222,7 +221,7 @@ pub fn frm_facet_temperature_py( /// float /// Flux in units of Jy. #[pyfunction] -#[pyo3(name = "neatm_flux", signature = (sun2obj, sun2obs, v_albedo, g_param, beaming, diameter, wavelength, emissivity=None))] +#[pyo3(name = "neatm_flux", signature = (sun2obj, sun2obs, v_albedo, g_param, beaming, diameter, wavelength, emissivity=0.9))] #[allow(clippy::too_many_arguments)] pub fn neatm_thermal_py( sun2obj: VectorLike, @@ -232,9 +231,8 @@ pub fn neatm_thermal_py( beaming: f64, diameter: f64, wavelength: f64, - emissivity: Option, + emissivity: f64, ) -> f64 { - let emissivity = emissivity.unwrap_or(0.9); let sun2obj = sun2obj.into_vec(PyFrames::Ecliptic); let sun2obs = sun2obs.into_vec(PyFrames::Ecliptic); @@ -292,7 +290,7 @@ pub fn neatm_thermal_py( /// float /// Flux in units of Jy. #[pyfunction] -#[pyo3(name = "frm_flux", signature = (sun2obj, sun2obs, v_albedo, g_param, diameter, wavelength, emissivity=None))] +#[pyo3(name = "frm_flux", signature = (sun2obj, sun2obs, v_albedo, g_param, diameter, wavelength, emissivity=0.9))] #[allow(clippy::too_many_arguments)] pub fn frm_thermal_py( sun2obj: VectorLike, @@ -301,9 +299,8 @@ pub fn frm_thermal_py( g_param: f64, diameter: f64, wavelength: f64, - emissivity: Option, + emissivity: f64, ) -> f64 { - let emissivity = emissivity.unwrap_or(0.9); let sun2obj = sun2obj.into_vec(PyFrames::Ecliptic); let sun2obs = sun2obs.into_vec(PyFrames::Ecliptic); let hg_params = HGParams::try_fill( diff --git a/src/kete/rust/flux/models.rs b/src/kete/rust/flux/models.rs index 411a77c..b341de7 100644 --- a/src/kete/rust/flux/models.rs +++ b/src/kete/rust/flux/models.rs @@ -194,7 +194,7 @@ impl PyNeatmParams { #[new] #[allow(clippy::too_many_arguments, missing_docs)] #[pyo3(signature = (desig, band_wavelength, band_albedos, h_mag=None, diam=None, - vis_albedo=None, beaming=None, g_param=None, c_hg=None, emissivity=None, zero_mags=None))] + vis_albedo=None, beaming=1.0, g_param=0.15, c_hg=None, emissivity=0.9, zero_mags=None))] pub fn new( desig: String, band_wavelength: Vec, @@ -202,15 +202,12 @@ impl PyNeatmParams { h_mag: Option, diam: Option, vis_albedo: Option, - beaming: Option, - g_param: Option, + beaming: f64, + g_param: f64, c_hg: Option, - emissivity: Option, + emissivity: f64, zero_mags: Option>, ) -> PyResult { - let emissivity = emissivity.unwrap_or(0.9); - let beaming = beaming.unwrap_or(1.0); - let g_param = g_param.unwrap_or(0.15); let hg_params = HGParams::try_fill(desig, g_param, h_mag, c_hg, vis_albedo, diam)?; let obs_bands = ObserverBands::Generic { @@ -256,21 +253,18 @@ impl PyNeatmParams { #[staticmethod] #[allow(clippy::too_many_arguments)] #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, - beaming=None, g_param=None, c_hg=None, emissivity=None))] + beaming=1.0, g_param=0.15, c_hg=None, emissivity=0.9))] pub fn new_wise( desig: String, band_albedos: Vec, h_mag: Option, diam: Option, vis_albedo: Option, - beaming: Option, - g_param: Option, + beaming: f64, + g_param: f64, c_hg: Option, - emissivity: Option, + emissivity: f64, ) -> PyResult { - let emissivity = emissivity.unwrap_or(0.9); - let beaming = beaming.unwrap_or(1.0); - let g_param = g_param.unwrap_or(0.15); let hg_params = HGParams::try_fill(desig, g_param, h_mag, c_hg, vis_albedo, diam)?; let band_albedos = match band_albedos.try_into() { @@ -311,8 +305,8 @@ impl PyNeatmParams { /// emissivity: /// Emissivity of the object, defaults to `0.9`. #[staticmethod] - #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, beaming=None, - g_param=None, c_hg=None, emissivity=None))] + #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, beaming=1.0, + g_param=0.15, c_hg=None, emissivity=0.9))] #[allow(clippy::too_many_arguments)] pub fn new_neos( desig: String, @@ -320,14 +314,11 @@ impl PyNeatmParams { h_mag: Option, diam: Option, vis_albedo: Option, - beaming: Option, - g_param: Option, + beaming: f64, + g_param: f64, c_hg: Option, - emissivity: Option, + emissivity: f64, ) -> PyResult { - let emissivity = emissivity.unwrap_or(0.9); - let beaming = beaming.unwrap_or(1.0); - let g_param = g_param.unwrap_or(0.15); let hg_params = HGParams::try_fill(desig, g_param, h_mag, c_hg, vis_albedo, diam)?; let band_albedos = match band_albedos.try_into() { @@ -533,7 +524,7 @@ impl PyFrmParams { #[new] #[allow(clippy::too_many_arguments, missing_docs)] #[pyo3(signature = (desig, band_wavelength, band_albedos, h_mag=None, diam=None, - vis_albedo=None, g_param=None, c_hg=None, emissivity=None, zero_mags=None))] + vis_albedo=None, g_param=0.15, c_hg=None, emissivity=0.9, zero_mags=None))] pub fn new( desig: String, band_wavelength: Vec, @@ -541,13 +532,11 @@ impl PyFrmParams { h_mag: Option, diam: Option, vis_albedo: Option, - g_param: Option, + g_param: f64, c_hg: Option, - emissivity: Option, + emissivity: f64, zero_mags: Option>, ) -> PyResult { - let emissivity = emissivity.unwrap_or(0.9); - let g_param = g_param.unwrap_or(0.15); let hg_params = HGParams::try_fill(desig, g_param, h_mag, c_hg, vis_albedo, diam)?; let obs_bands = ObserverBands::Generic { solar_correction: vec![1.0; band_wavelength.len()], @@ -589,20 +578,18 @@ impl PyFrmParams { /// Emissivity of the object, defaults to `0.9`. #[staticmethod] #[allow(clippy::too_many_arguments)] - #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, g_param=None, - c_hg=None, emissivity=None))] + #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, g_param=0.15, + c_hg=None, emissivity=0.9))] pub fn new_wise( desig: String, band_albedos: Vec, h_mag: Option, diam: Option, vis_albedo: Option, - g_param: Option, + g_param: f64, c_hg: Option, - emissivity: Option, + emissivity: f64, ) -> PyResult { - let emissivity = emissivity.unwrap_or(0.9); - let g_param = g_param.unwrap_or(0.15); let hg_params = HGParams::try_fill(desig, g_param, h_mag, c_hg, vis_albedo, diam)?; let band_albedos = match band_albedos.try_into() { @@ -639,20 +626,18 @@ impl PyFrmParams { /// Emissivity of the object, defaults to `0.9`. #[staticmethod] #[allow(clippy::too_many_arguments)] - #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, g_param=None, - c_hg=None, emissivity=None))] + #[pyo3(signature = (desig, band_albedos, h_mag=None, diam=None, vis_albedo=None, g_param=0.15, + c_hg=None, emissivity=0.9))] pub fn new_neos( desig: String, band_albedos: Vec, h_mag: Option, diam: Option, vis_albedo: Option, - g_param: Option, + g_param: f64, c_hg: Option, - emissivity: Option, + emissivity: f64, ) -> PyResult { - let emissivity = emissivity.unwrap_or(0.9); - let g_param = g_param.unwrap_or(0.15); let hg_params = HGParams::try_fill(desig, g_param, h_mag, c_hg, vis_albedo, diam)?; let band_albedos = match band_albedos.try_into() { diff --git a/src/kete/wise.py b/src/kete/wise.py index 27037b7..56e331f 100644 --- a/src/kete/wise.py +++ b/src/kete/wise.py @@ -16,10 +16,9 @@ from .time import Time from .vector import Vector, Frames from .irsa import IRSA_URL, query_irsa_tap, plot_fits_image, zoom_plot, annotate_plot +from .fov import WiseCmos, FOVList from ._core import ( - WiseCmos, - FOVList, w1_color_correction, w2_color_correction, w3_color_correction, diff --git a/src/kete_core/src/spice/pck.rs b/src/kete_core/src/spice/pck.rs index aa02139..0928821 100644 --- a/src/kete_core/src/spice/pck.rs +++ b/src/kete_core/src/spice/pck.rs @@ -94,10 +94,12 @@ pub fn get_pck_singleton() -> &'static PckSingleton { files.reset(); let singleton: PckSingleton = ShardedLock::new(files); // Store it to the static var, i.e. initialize it + #[allow(static_mut_refs)] let _ = SINGLETON.write(singleton); }); // Now we give out a shared reference to the data, which is safe to use concurrently. + #[allow(static_mut_refs)] SINGLETON.assume_init_ref() } } diff --git a/src/kete_core/src/spice/spk.rs b/src/kete_core/src/spice/spk.rs index 37ff4b5..59715fa 100644 --- a/src/kete_core/src/spice/spk.rs +++ b/src/kete_core/src/spice/spk.rs @@ -324,11 +324,13 @@ pub fn get_spk_singleton() -> &'static SpkSingleton { segments.reset(); let singleton: SpkSingleton = ShardedLock::new(segments); // Store it to the static var, i.e. initialize it + #[allow(static_mut_refs)] let _ = SINGLETON.write(singleton); }); // Now we give out a shared reference to the data, which is safe to use // concurrently. + #[allow(static_mut_refs)] SINGLETON.assume_init_ref() } }