Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Feb 21, 2024
1 parent fa00bbf commit 698f65a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 30 deletions.
4 changes: 3 additions & 1 deletion maria/atmosphere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
3 changes: 1 addition & 2 deletions maria/atmosphere/turbulent_layer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions maria/instrument/bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
22 changes: 10 additions & 12 deletions maria/sim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
):
Expand Down Expand Up @@ -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"):
Expand Down
9 changes: 4 additions & 5 deletions maria/sim/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import warnings

import numpy as np

Expand Down Expand Up @@ -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)."
Expand Down
10 changes: 0 additions & 10 deletions maria/tests/test_map_obs.py

This file was deleted.

0 comments on commit 698f65a

Please sign in to comment.