diff --git a/maria/atmosphere/__init__.py b/maria/atmosphere/__init__.py index 565a8d2..79ac2c0 100644 --- a/maria/atmosphere/__init__.py +++ b/maria/atmosphere/__init__.py @@ -147,7 +147,9 @@ def _simulate_2d_turbulence(self): (self.n_atmosphere_layers, self.instrument.n_dets, self.plan.n_time) ) - layers = tqdm(self.atmosphere.layers) if self.verbose else self.atmosphere.layers + layers = ( + tqdm(self.atmosphere.layers) if self.verbose else self.atmosphere.layers + ) for layer_index, layer in enumerate(layers): if self.verbose: layers.set_description(f"Generating atmosphere (z={layer.depth:.00f}m)") diff --git a/maria/atmosphere/turbulent_layer.py b/maria/atmosphere/turbulent_layer.py index 26f9b22..d7dfff9 100644 --- a/maria/atmosphere/turbulent_layer.py +++ b/maria/atmosphere/turbulent_layer.py @@ -1,8 +1,7 @@ +import dask.array as da import numpy as np import scipy as sp -import dask.array as da - from .. import utils from ..coords import Coordinates, get_center_phi_theta from ..instrument import Instrument diff --git a/maria/instrument/bands.py b/maria/instrument/bands.py index 680fe15..4410866 100644 --- a/maria/instrument/bands.py +++ b/maria/instrument/bands.py @@ -21,6 +21,10 @@ here, this_filename = os.path.split(__file__) +all_bands = {} +for path in glob.glob(f"{here}/bands/*.yml"): + tag = os.path.split(path)[1].split(".")[0] + all_bands[tag] = read_yaml(path) all_bands = {} for path in glob.glob(f"{here}/bands/*.yml"): tag = os.path.split(path)[1].split(".")[0] diff --git a/maria/sim/__init__.py b/maria/sim/__init__.py index 7a12eb3..eb61e98 100644 --- a/maria/sim/__init__.py +++ b/maria/sim/__init__.py @@ -6,7 +6,7 @@ from ..atmosphere import Atmosphere, AtmosphereMixin from ..cmb import CMBMixin -from ..map import Map, MapMixin +from ..map import MapMixin from ..noise import NoiseMixin from .base import BaseSimulation, master_params, parse_sim_kwargs @@ -25,7 +25,6 @@ def __init__( instrument: str or Instrument = "MUSTANG-2", plan: str or Plan = "stare", site: str or Site = "hoagie_haven", - map: str or Map = None, verbose: bool = True, **kwargs, ): @@ -56,22 +55,21 @@ def __init__( setattr(self, k, kwargs.get(k, v)) self.params[sub_type][k] = v - weather_override = {k: v for k, v in {"pwv": self.pwv}.items() if v} - - self.weather = Weather( - t=self.plan.time.mean(), - region=self.site.region, - altitude=self.site.altitude, - quantiles=self.site.weather_quantiles, - override=weather_override, - ) - if self.map_file: if not os.path.exists(self.map_file): raise FileNotFoundError(self.map_file) self._initialize_map() if self.atmosphere_model: + weather_override = {k: v for k, v in {"pwv": self.pwv}.items() if v} + + self.atmosphere = Atmosphere( + t=self.plan.time.mean(), + region=self.site.region, + altitude=self.site.altitude, + weather_override=weather_override, + ) + self._initialize_atmosphere() def _run(self, units="K_RJ"): diff --git a/maria/sim/base.py b/maria/sim/base.py index d5d40df..850579c 100644 --- a/maria/sim/base.py +++ b/maria/sim/base.py @@ -1,5 +1,4 @@ import os -import warnings import numpy as np @@ -96,16 +95,16 @@ def __init__( frame=self.plan.pointing_frame, ) - if self.pointing.max_vel > np.radians(self.instrument.vel_limit): - raise PointingError( + if self.plan.max_vel > np.radians(self.instrument.vel_limit): + raise ValueError( ( f"The maximum velocity of the boresight ({np.degrees(self.plan.max_vel):.01f} deg/s) exceeds " f"the maximum velocity of the instrument ({self.instrument.vel_limit:.01f} deg/s)." ), ) - if self.pointing.max_acc > np.radians(self.instrument.acc_limit): - raise PointingError( + if self.plan.max_acc > np.radians(self.instrument.acc_limit): + raise ValueError( ( f"The maximum acceleration of the boresight ({np.degrees(self.plan.max_acc):.01f} deg/s^2) exceeds " f"the maximum acceleration of the instrument ({self.instrument.acc_limit:.01f} deg/s^2)." diff --git a/maria/tests/test_map_obs.py b/maria/tests/test_map_obs.py deleted file mode 100644 index 9472df4..0000000 --- a/maria/tests/test_map_obs.py +++ /dev/null @@ -1,10 +0,0 @@ -# import pytest -# import maria -# from maria.atmosphere import LinearAngularSimulation - - -# @pytest.mark.map -# def test_linear_angular_model(): - -# sim = LinearAngularSimulation(instrument="MUSTANG-2", pointing="STARE_0az_90el_60s", site="GBT", atm_model="linear_angular") -# tod = sim.run()