From c3e08b43e4a9d59a1f549398e1ba2ee62362ccea Mon Sep 17 00:00:00 2001 From: Metin San Date: Mon, 16 Aug 2021 14:49:23 +0200 Subject: [PATCH] Added possibility to use hours as stepsize --- zodipy/_coordinates.py | 4 ++-- zodipy/simulation.py | 5 ++--- zodipy/zodi.py | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zodipy/_coordinates.py b/zodipy/_coordinates.py index cdd7ecc..5f7d530 100644 --- a/zodipy/_coordinates.py +++ b/zodipy/_coordinates.py @@ -18,7 +18,7 @@ @functools.lru_cache def get_target_coordinates( - target: str, start: datetime, stop:datetime = None, step: int = 1 + target: str, start: datetime, stop:datetime = None, step: str = '1d' ) -> np.ndarray: """Returns the heliocentric cartesian coordinates of the target. @@ -48,7 +48,7 @@ def get_target_coordinates( else: stop_ = stop - epochs = dict(start=str(start), stop=str(stop_), step=f'{step}d') + epochs = dict(start=str(start), stop=str(stop_), step=f'{step}') query = Horizons(id=target, id_type='majorbody', location='c@sun', epochs=epochs) ephemerides = query.ephemerides() diff --git a/zodipy/simulation.py b/zodipy/simulation.py index 2917bf7..434a910 100644 --- a/zodipy/simulation.py +++ b/zodipy/simulation.py @@ -125,6 +125,7 @@ def simulate(self, nside: int, freq: float, mask: float) -> np.ndarray: pixels = self.get_observed_pixels(X_observer, X_unit, ang=mask) components = self.model.components + emissivities = self.model.emissivities # The emission is initialized as NANs representing unobserved pixels emission = np.zeros((n_observations, len(components), npix)) + np.NAN @@ -144,9 +145,7 @@ def simulate(self, nside: int, freq: float, mask: float) -> np.ndarray: comp_emission, R, dx=integration_config.dR, axis=0 ) - comp_emissivity = self.model.emissivities.get_emissivity( - comp_name, freq - ) + comp_emissivity = emissivities.get_emissivity(comp_name, freq) integrated_comp_emission *= comp_emissivity emission[observation_idx, comp_idx, observed_pixels] = integrated_comp_emission diff --git a/zodipy/zodi.py b/zodipy/zodi.py index ebee4c7..293e4e0 100644 --- a/zodipy/zodi.py +++ b/zodipy/zodi.py @@ -22,7 +22,7 @@ def __init__( observer: Optional[str] = 'L2', start: Optional[datetime] = datetime.now().date(), stop: Optional[datetime] = None, - step: Optional[int] = 1, + step: Optional[str] = '1d', model: Optional[str] = 'planck 2018', integration_config: Optional[str] = 'default' ) -> None: @@ -43,8 +43,9 @@ def __init__( Datetime object represetning the time when the observation ended. If None, the observation is assumed to only occur on the start date. Defaults to None. - step : int - Step size in number of days from start to stop. Defaults to 1. + step : str + Step size from the start to stop dates in days denoted by 'd' + or hours 'h'. Defaults to 1 day ('1d'). model : str, optional String representing the Interplanteary dust model used in the simulation. Available options are 'planck 2013', 'planck 2015',