diff --git a/docs/source/instruments.rst b/docs/source/instruments.rst index 3e74f9b..1968979 100644 --- a/docs/source/instruments.rst +++ b/docs/source/instruments.rst @@ -46,12 +46,27 @@ These are all valid: .. code-block:: python - f090 = {"center": 90, "width": 30} - f150 = {"center": 150, "width": 30} - dets = {"n": 500, - "field_of_view": 2 + dets = { + "subarray-1": { + "n": 500, + "field_of_view": 2, "array_shape": "hex", - "bands": [f090, f150]} - - my_custom_array = maria.get_instrument(dets=dets) + "bands": [{"center": 30, "width": 5}, {"center": 40, "width": 5}], + }, + "subarray-2": { + "n": 500, + "field_of_view": 2, + "array_shape": "hex", + "bands": [{"center": 90, "width": 5}, {"center": 150, "width": 5}], + }, + } + + dets = { + "n": 500, + "field_of_view": 2, + "array_shape": "hex", + "bands": ["alma/f043", "alma/f078"], + } + + dets = {"file": "path_to_some_dets_file.csv"} diff --git a/docs/source/papers.rst b/docs/source/papers.rst index 830f538..425f35f 100644 --- a/docs/source/papers.rst +++ b/docs/source/papers.rst @@ -1,4 +1,6 @@ Papers ====== -`Morris et al. (2022) `_ +`T. W. Morris et al. (2022) `_ + +`J. van Marrewijk, T. W. Morris et al. (2024) `_ diff --git a/docs/source/pointings.rst b/docs/source/pointings.rst index d1d380c..eb0e476 100644 --- a/docs/source/pointings.rst +++ b/docs/source/pointings.rst @@ -1,19 +1,72 @@ -Customizing pointings -+++++++++++++++++++++ +=========== +Pointings +=========== -We can simulate observing (and later mapping) some celestial signal by supplying the simulation with a map to use as the ground truth. +The observing pointing is instantiated as an ``Pointing``. +The simplest way to get an pointing is to grab a pre-defined one, e.g.:: + # The Atacama Cosmology Telescope + act = maria.get_pointing('ACT') - -Simulations are made up of an array (defining the instrument), a site (where on earth it is), and a pointing (defining how it observes). Simulations for a few different telescopes might be instantiated as:: + # The Atacama Large Millimeter Array + alma = maria.get_pointing('ALMA') # MUSTANG-2 - mustang2_sim = Simulation(array='MUSTANG-2', - site='green_bank', - pointing='daisy', - map_file=path_to_some_fits_file, # Input files must be a fits file. - map_units='Jy/pixel', # Units of the input map in Kelvin Rayleigh Jeans (K, defeault) or Jy/pixel - map_res=pixel_size, - map_center=(10, 4.5), # RA & Dec. in degrees - map_freqs=[90], - degrees=True) + m2 = maria.get_pointing('MUSTANG-2') + + ++++++++++++++++++++++++ +Customizing Pointings ++++++++++++++++++++++++ + +One way to customize pointings is to load a pre-defined pointing and pass extra parameters. +For example, we can give ACT twice the resolution with + +.. code-block:: python + + act = maria.get_pointing('ACT', primary_size=12) + + +Custom arrays of detectors are a bit more complicated. For example: + +.. code-block:: python + + f090 = {"center": 90, "width": 30} + f150 = {"center": 150, "width": 30} + + dets = {"n": 500, + "field_of_view": 2 + "array_shape": "hex", + "bands": [f090, f150]} + + my_custom_array = maria.get_pointing(dets=dets) + +Actually, there are several valid ways to define an array of detectors. +These are all valid: + +.. code-block:: python + + + dets = { + "subarray-1": { + "n": 500, + "field_of_view": 2, + "array_shape": "hex", + "bands": [{"center": 30, "width": 5}, {"center": 40, "width": 5}], + }, + "subarray-2": { + "n": 500, + "field_of_view": 2, + "array_shape": "hex", + "bands": [{"center": 90, "width": 5}, {"center": 150, "width": 5}], + }, + } + + dets = { + "n": 500, + "field_of_view": 2, + "array_shape": "hex", + "bands": ["alma/f043", "alma/f078"], + } + + dets = {"file": "path_to_some_dets_file.csv"} diff --git a/maria/__init__.py b/maria/__init__.py index e330dc3..16a43db 100644 --- a/maria/__init__.py +++ b/maria/__init__.py @@ -10,7 +10,7 @@ from . import utils # noqa F401 from .instrument import all_instruments, get_instrument # noqa F401 from .map import Map, mappers # noqa F401 -from .pointing import all_pointings, get_pointing # noqa F401 +from .plan import all_plans, get_plan # noqa F401 from .sim import Simulation # noqa F401 from .site import all_regions, all_sites, get_site # noqa F401 from .tod import TOD # noqa F401 diff --git a/maria/atmosphere/__init__.py b/maria/atmosphere/__init__.py index fb6880f..16ef28a 100644 --- a/maria/atmosphere/__init__.py +++ b/maria/atmosphere/__init__.py @@ -68,7 +68,7 @@ def _simulate_2d_turbulence(self): """ layer_data = np.zeros( - (self.n_atmosphere_layers, self.instrument.n_dets, self.pointing.n_time) + (self.n_atmosphere_layers, self.instrument.n_dets, self.plan.n_time) ) layers = tqdm(self.turbulent_layers) if self.verbose else self.turbulent_layers @@ -106,7 +106,7 @@ def _simulate_atmospheric_emission(self, units="K_RJ"): if units == "K_RJ": # Kelvin Rayleigh-Jeans self._simulate_atmospheric_fluctuations() self.data["atmosphere"] = np.empty( - (self.instrument.n_dets, self.pointing.n_time), dtype=np.float32 + (self.instrument.n_dets, self.plan.n_time), dtype=np.float32 ) bands = ( diff --git a/maria/atmosphere/turbulent_layer.py b/maria/atmosphere/turbulent_layer.py index 52bfbb0..5a38457 100644 --- a/maria/atmosphere/turbulent_layer.py +++ b/maria/atmosphere/turbulent_layer.py @@ -39,7 +39,7 @@ def __init__( self.res = res # this is approximately correct - # self.depth = self.depth / np.sin(np.mean(self.pointing.el)) + # self.depth = self.depth / np.sin(np.mean(self.plan.el)) # this might change self.angular_outer_scale = turbulent_outer_scale / self.depth diff --git a/maria/cmb/__init__.py b/maria/cmb/__init__.py index 8be91c8..aaaf6f7 100644 --- a/maria/cmb/__init__.py +++ b/maria/cmb/__init__.py @@ -1,3 +1,7 @@ +class CMB: + ... + + class CMBMixin: ... @@ -6,8 +10,8 @@ class CMBMixin: # """ # This simulates scanning over celestial sources. # """ -# def __init__(self, instrument, pointing, site, map_file, add_cmb=False, **kwargs): -# super().__init__(instrument, pointing, site) +# def __init__(self, instrument, plan, site, map_file, add_cmb=False, **kwargs): +# super().__init__(instrument, plan, site) # pass @@ -46,7 +50,7 @@ class CMBMixin: # np.array([self.CMB_PS[bandnumber]]), # [0], # beam=None, -# seed=self.pointing.seed, +# seed=self.plan.seed, # )[0] # self.CMB_map += utils.Tcmb diff --git a/maria/map/__init__.py b/maria/map/__init__.py index 430be17..c858f16 100644 --- a/maria/map/__init__.py +++ b/maria/map/__init__.py @@ -164,7 +164,7 @@ def _initialize_map(self): if not self.map_file: return - self.input_map_file = self.map_file + self.map_file = self.map_file hudl = ap.io.fits.open(self.map_file) map_data = hudl[0].data @@ -193,7 +193,7 @@ def _initialize_map(self): self.map_data = map_data - self.input_map = Map( + self.map = Map( data=map_data, header=hudl[0].header, freqs=np.atleast_1d(self.map_freqs), @@ -206,30 +206,26 @@ def _initialize_map(self): units=self.map_units, ) - self.input_map.header["HISTORY"] = "History_input_adjustments" - self.input_map.header["comment"] = "Changed input CDELT1 and CDELT2" - self.input_map.header["comment"] = ( - "Changed surface brightness units to " + self.input_map.units + self.map.header["HISTORY"] = "History_input_adjustments" + self.map.header["comment"] = "Changed input CDELT1 and CDELT2" + self.map.header["comment"] = ( + "Changed surface brightness units to " + self.map.units ) - self.input_map.header["comment"] = "Repositioned the map on the sky" + self.map.header["comment"] = "Repositioned the map on the sky" - if self.input_map.inbright is not None: - self.input_map.data *= self.input_map.inbright / np.nanmax( - self.input_map.data - ) - self.input_map.header["comment"] = "Amplitude is rescaled." + if self.map.inbright is not None: + self.map.data *= self.map.inbright / np.nanmax(self.map.data) + self.map.header["comment"] = "Amplitude is rescaled." def _run(self, **kwargs): self.sample_maps() def _sample_maps(self): - dx, dy = self.det_coords.offsets( - frame=self.map_frame, center=self.input_map.center - ) + dx, dy = self.det_coords.offsets(frame=self.map_frame, center=self.map.center) self.data["map"] = np.zeros((dx.shape)) - freqs = tqdm(self.input_map.freqs) if self.verbose else self.input_map.freqs + freqs = tqdm(self.map.freqs) if self.verbose else self.map.freqs for i, nu in enumerate(freqs): if self.verbose: freqs.set_description("Sampling input map") @@ -238,15 +234,13 @@ def _sample_maps(self): nu_fwhm = beams.compute_angular_fwhm( fwhm_0=self.instrument.primary_size, z=np.inf, f=1e9 * nu ) - nu_map_filter = beams.construct_beam_filter( - fwhm=nu_fwhm, res=self.input_map.res - ) + nu_map_filter = beams.construct_beam_filter(fwhm=nu_fwhm, res=self.map.res) filtered_nu_map_data = beams.separably_filter( - self.input_map.data[i], nu_map_filter + self.map.data[i], nu_map_filter ) # band_res_radians = 1.22 * (299792458 / (1e9 * nu)) / self.instrument.primary_size - # band_res_pixels = band_res_radians / self.input_map.res + # band_res_pixels = band_res_radians / self.map.res # FWHM_TO_SIGMA = 2.355 # band_beam_sigma_pixels = band_res_pixels / FWHM_TO_SIGMA @@ -257,7 +251,7 @@ def _sample_maps(self): det_mask = det_freq_response > -np.inf # -1e-3 samples = sp.interpolate.RegularGridInterpolator( - (self.input_map.x_side, self.input_map.y_side), + (self.map.x_side, self.map.y_side), filtered_nu_map_data, bounds_error=False, fill_value=0, diff --git a/maria/noise/__init__.py b/maria/noise/__init__.py index 6e7d720..f141214 100644 --- a/maria/noise/__init__.py +++ b/maria/noise/__init__.py @@ -8,17 +8,17 @@ def _run(self): self._simulate_noise() def _simulate_noise(self): - self.data["noise"] = np.zeros((self.instrument.n_dets, self.pointing.n_time)) + self.data["noise"] = np.zeros((self.instrument.n_dets, self.plan.n_time)) for band in self.instrument.dets.bands: band_index = self.instrument.dets.subset(band=band.name).index if band.white_noise > 0: self.data["noise"][band_index] += ( - np.sqrt(self.pointing.sample_rate) + np.sqrt(self.plan.sample_rate) * band.white_noise * np.random.standard_normal( - size=(len(band_index), self.pointing.n_time) + size=(len(band_index), self.plan.n_time) ) ) @@ -26,8 +26,8 @@ def _simulate_noise(self): for i in band_index: self.data["noise"][i] += band.pink_noise * self._spectrum_noise( spectrum_func=self._pink_spectrum, - size=int(self.pointing.n_time), - dt=self.pointing.dt, + size=int(self.plan.n_time), + dt=self.plan.dt, ) def _spectrum_noise(self, spectrum_func, size, dt, amp=2.0): diff --git a/maria/pointing/__init__.py b/maria/plan/__init__.py similarity index 82% rename from maria/pointing/__init__.py rename to maria/plan/__init__.py index d7b7345..c549b4a 100644 --- a/maria/pointing/__init__.py +++ b/maria/plan/__init__.py @@ -17,43 +17,43 @@ here, this_filename = os.path.split(__file__) -pointing_configs = utils.io.read_yaml(f"{here}/pointings.yml") -pointing_params = set() -for key, config in pointing_configs.items(): - pointing_params |= set(config.keys()) -pointing_data = pd.DataFrame(pointing_configs).T -all_pointings = list(pointing_data.index.values) +plan_configs = utils.io.read_yaml(f"{here}/plans.yml") +plan_params = set() +for key, config in plan_configs.items(): + plan_params |= set(config.keys()) +plan_data = pd.DataFrame(plan_configs).T +all_plans = list(plan_data.index.values) -class UnsupportedPointingError(Exception): - def __init__(self, invalid_pointing): +class UnsupportedPlanError(Exception): + def __init__(self, invalid_plan): super().__init__( - f"""The site '{invalid_pointing}' is not in the database of default pointings.""" - f"""Default pointings are:\n\n{pointing_data.to_string()}""" + f"""The site '{invalid_plan}' is not in the database of default plans.""" + f"""Default plans are:\n\n{plan_data.to_string()}""" ) -def get_pointing_config(scan_pattern="stare", **kwargs): - if scan_pattern not in pointing_configs.keys(): - raise UnsupportedPointingError(scan_pattern) - pointing_config = pointing_configs[scan_pattern].copy() +def get_plan_config(scan_pattern="stare", **kwargs): + if scan_pattern not in plan_configs.keys(): + raise UnsupportedPlanError(scan_pattern) + plan_config = plan_configs[scan_pattern].copy() for k, v in kwargs.items(): - pointing_config[k] = v - return pointing_config + plan_config[k] = v + return plan_config -def get_pointing(scan_pattern="stare", **kwargs): - pointing_config = get_pointing_config(scan_pattern, **kwargs) - return Pointing(**pointing_config) +def get_plan(scan_pattern="stare", **kwargs): + plan_config = get_plan_config(scan_pattern, **kwargs) + return Plan(**plan_config) @dataclass -class Pointing: +class Plan: """ - A dataclass containing time-ordered pointing data. + A dataclass containing time-ordered plan data. """ - pointing_description: str = "" + description: str = "" start_time: str = "2022-02-10T06:00:00" integration_time: float = 60.0 sample_rate: float = 20.0 @@ -66,13 +66,13 @@ class Pointing: @staticmethod def validate_pointing_kwargs(kwargs): """ - Make sure that we have all the ingredients to produce the pointing data. + Make sure that we have all the ingredients to produce the plan data. """ if ("end_time" not in kwargs.keys()) and ( "integration_time" not in kwargs.keys() ): raise ValueError( - """One of 'end_time' or 'integration_time' must be in the pointing kwargs.""" + """One of 'end_time' or 'integration_time' must be in the plan kwargs.""" ) def __post_init__(self): @@ -80,7 +80,7 @@ def __post_init__(self): self.scan_center = tuple(self.scan_center) - for k, v in pointing_configs[self.scan_pattern]["scan_options"].items(): + for k, v in plan_configs[self.scan_pattern]["scan_options"].items(): if k not in self.scan_options.keys(): self.scan_options[k] = v diff --git a/maria/pointing/patterns.py b/maria/plan/patterns.py similarity index 100% rename from maria/pointing/patterns.py rename to maria/plan/patterns.py diff --git a/maria/pointing/pointings.yml b/maria/plan/plans.yml similarity index 83% rename from maria/pointing/pointings.yml rename to maria/plan/plans.yml index 31ff1f0..086f64b 100644 --- a/maria/pointing/pointings.yml +++ b/maria/plan/plans.yml @@ -1,5 +1,5 @@ stare: - pointing_description: A stare. + description: A stare. integration_time: 60 scan_pattern: stare pointing_frame: az_el @@ -9,7 +9,7 @@ stare: scan_options: {} daisy: - pointing_description: A daisy scan. + description: A daisy scan. pointing_frame: ra_dec degrees: True scan_pattern: daisy @@ -23,7 +23,7 @@ daisy: miss_freq: 1.41 back_and_forth: - pointing_description: A back-and-forth scan. + description: A back-and-forth scan. start_time: '2022-07-01T08:00:00' integration_time: 60 scan_pattern: back_and_forth @@ -37,7 +37,7 @@ back_and_forth: speed: 0.5 double_circle: - pointing_description: 'A double circle scan.' + description: 'A double circle scan.' pointing_frame: ra_dec integration_time: 60 sample_rate: 50 diff --git a/maria/sim/__init__.py b/maria/sim/__init__.py index 69d9c91..e5a2c28 100644 --- a/maria/sim/__init__.py +++ b/maria/sim/__init__.py @@ -1,12 +1,12 @@ import os from maria.instrument import Instrument -from maria.pointing import Pointing +from maria.plan import Plan from maria.site import Site from ..atmosphere import AtmosphereMixin, Weather from ..cmb import CMBMixin -from ..map import MapMixin +from ..map import Map, MapMixin from ..noise import NoiseMixin from .base import BaseSimulation, master_params, parse_sim_kwargs @@ -23,8 +23,9 @@ def from_config(cls, config: dict = {}, **params): def __init__( self, instrument: str or Instrument = "MUSTANG-2", - pointing: str or Pointing = "stare", + plan: str or Plan = "stare", site: str or Site = "hoagie_haven", + map: str or Map = None, verbose: bool = True, **kwargs, ): @@ -32,11 +33,11 @@ def __init__( super().__init__( instrument, - pointing, + plan, site, verbose=verbose, **self.parsed_sim_kwargs["instrument"], - **self.parsed_sim_kwargs["pointing"], + **self.parsed_sim_kwargs["plan"], **self.parsed_sim_kwargs["site"], ) @@ -44,7 +45,7 @@ def __init__( for sub_type, sub_master_params in master_params.items(): self.params[sub_type] = {} - if sub_type in ["instrument", "site", "pointing"]: + if sub_type in ["instrument", "site", "plan"]: sub_type_dataclass = getattr(self, sub_type) for k in sub_type_dataclass.__dataclass_fields__.keys(): v = getattr(sub_type_dataclass, k) @@ -58,7 +59,7 @@ def __init__( weather_override = {k: v for k, v in {"pwv": self.pwv}.items() if v} self.weather = Weather( - t=self.pointing.time.mean(), + t=self.plan.time.mean(), region=self.site.region, altitude=self.site.altitude, quantiles=self.site.weather_quantiles, @@ -92,7 +93,6 @@ def _run(self, units="K_RJ"): def __repr__(self): object_reprs = [ - getattr(self, attr).__repr__() - for attr in ["instrument", "site", "pointing"] + getattr(self, attr).__repr__() for attr in ["instrument", "site", "plan"] ] return "\n\n".join(object_reprs) diff --git a/maria/sim/base.py b/maria/sim/base.py index 838a000..a3239be 100644 --- a/maria/sim/base.py +++ b/maria/sim/base.py @@ -6,7 +6,7 @@ from .. import utils from ..coords import Coordinates, dx_dy_to_phi_theta from ..instrument import Instrument, get_instrument -from ..pointing import Pointing, get_pointing +from ..plan import Plan, get_plan from ..site import Site, get_site from ..tod import TOD @@ -53,7 +53,7 @@ class BaseSimulation: def __init__( self, instrument: Instrument or str = "default", - pointing: Pointing or str = "stare", + plan: Plan or str = "stare", site: Site or str = "default", verbose=False, **kwargs, @@ -67,45 +67,47 @@ def __init__( parsed_sim_kwargs = parse_sim_kwargs(kwargs, master_params) - if type(instrument) is Instrument: + if isinstance(instrument, Instrument): self.instrument = instrument else: self.instrument = get_instrument( instrument_name=instrument, **parsed_sim_kwargs["instrument"] ) - if type(pointing) is Pointing: - self.pointing = pointing + if isinstance(plan, Plan): + self.plan = plan else: - self.pointing = get_pointing( - scan_pattern=pointing, **parsed_sim_kwargs["pointing"] - ) + self.plan = get_plan(scan_pattern=plan, **parsed_sim_kwargs["plan"]) - if type(site) is Site: + if isinstance(site, Site): self.site = site - else: + elif isinstance(site, str): self.site = get_site(site_name=site, **parsed_sim_kwargs["site"]) + else: + raise ValueError( + "The passed site must be either a Site object or a string." + ) self.boresight = Coordinates( - self.pointing.time, - self.pointing.phi, - self.pointing.theta, + self.plan.time, + self.plan.phi, + self.plan.theta, location=self.site.earth_location, - frame=self.pointing.pointing_frame, + frame=self.plan.pointing_frame, ) - if self.pointing.max_vel > np.radians(self.instrument.vel_limit): + if self.plan.max_vel > np.radians(self.instrument.vel_limit): raise warnings.warn( ( - f"The maximum velocity of the boresight ({np.degrees(self.pointing.max_vel):.01f} deg/s) exceeds " + 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): + if self.plan.max_acc > np.radians(self.instrument.acc_limit): raise warnings.warn( ( - f"The maximum acceleration of the boresight ({np.degrees(self.pointing.max_acc):.01f} deg/s^2) exceeds " + 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/sim/default_params.yml b/maria/sim/default_params.yml index 30ec631..11b61ed 100644 --- a/maria/sim/default_params.yml +++ b/maria/sim/default_params.yml @@ -22,8 +22,8 @@ instrument: # defaults to a small test instrument max_el_acc: 0.25 instrument_documentation: '' -pointing: # defaults to a 45 degree stare due north - pointing_description: '' +plan: # defaults to a 45 degree stare due north + plan_description: '' start_time: 2022-02-10T06:00:00 integration_time: 60 # in seconds pointing_frame: az_el diff --git a/maria/tests/test_atmosphere.py b/maria/tests/test_atmosphere.py index de5f91c..6f9f80a 100644 --- a/maria/tests/test_atmosphere.py +++ b/maria/tests/test_atmosphere.py @@ -7,7 +7,7 @@ def test_atmosphere_2d(): sim = Simulation( instrument="MUSTANG-2", - pointing="daisy", + plan="daisy", site="green_bank", atmosphere_model="2d", ) diff --git a/maria/tests/test_instruments.py b/maria/tests/test_instruments.py index a81c54c..984a85e 100644 --- a/maria/tests/test_instruments.py +++ b/maria/tests/test_instruments.py @@ -2,21 +2,18 @@ import maria -f090 = {"center": 90, "width": 10} -f150 = {"center": 150, "width": 20} - dets1 = { - "array1": { + "subarray-1": { "n": 500, "field_of_view": 2, "array_shape": "hex", - "bands": [f090, f150], + "bands": [{"center": 30, "width": 5}, {"center": 40, "width": 5}], }, - "array2": { + "subarray-2": { "n": 500, "field_of_view": 2, "array_shape": "hex", - "bands": [f090, f150], + "bands": [{"center": 90, "width": 5}, {"center": 150, "width": 5}], }, } @@ -24,15 +21,17 @@ "n": 500, "field_of_view": 2, "array_shape": "hex", - "bands": {"f090": {"center": 90, "width": 10}}, + "bands": ["alma/f043", "alma/f078"], } +dets3 = {"file": "data/alma/alma.cycle1.total.csv"} + @pytest.mark.parametrize("instrument_name", maria.all_instruments) def test_get_instrument(instrument_name): instrument = maria.get_instrument(instrument_name) -@pytest.mark.parametrize("dets", [dets1, dets2]) +@pytest.mark.parametrize("dets", [dets1, dets2, dets3]) def test_get_custom_array(dets): instrument = maria.get_instrument(dets=dets) diff --git a/maria/tests/test_noise_sims.py b/maria/tests/test_noise_sims.py index 525b549..88f3c34 100644 --- a/maria/tests/test_noise_sims.py +++ b/maria/tests/test_noise_sims.py @@ -7,7 +7,7 @@ def test_linear_angular_model(): noise_sim = NoiseSimulation( instrument="MUSTANG-2", - pointing="daisy", + plan="daisy", site="green_bank", white_noise_level=1e0, ) diff --git a/maria/tests/test_pipeline.py b/maria/tests/test_pipeline.py index f3963f9..98998f8 100644 --- a/maria/tests/test_pipeline.py +++ b/maria/tests/test_pipeline.py @@ -37,8 +37,8 @@ def test_mustang2(): # Mandatory minimal weither settings # --------------------- instrument="MUSTANG-2", # Instrument type - pointing="daisy", # Scanning strategy site="green_bank", # Site + plan="daisy", # Scanning strategy atmosphere_model=atm_model, # atmospheric model white_noise_level=white_noise_level, # white noise level pink_noise_level=pink_noise_level, # pink noise level diff --git a/maria/tests/test_plans.py b/maria/tests/test_plans.py new file mode 100644 index 0000000..2f8cc66 --- /dev/null +++ b/maria/tests/test_plans.py @@ -0,0 +1,8 @@ +import pytest + +import maria + + +@pytest.mark.parametrize("plan_name", maria.all_plans) +def test_get_plan(plan_name): + plan = maria.get_plan(plan_name) diff --git a/maria/tests/test_pointings.py b/maria/tests/test_pointings.py deleted file mode 100644 index d41520c..0000000 --- a/maria/tests/test_pointings.py +++ /dev/null @@ -1,18 +0,0 @@ -import pytest - -import maria - - -@pytest.mark.parametrize("instrument_name", maria.all_instruments) -def test_get_instrument(instrument_name): - instrument = maria.get_instrument(instrument_name) - - -@pytest.mark.parametrize("pointing_name", maria.all_pointings) -def test_get_pointing(pointing_name): - pointing = maria.get_pointing(pointing_name) - - -@pytest.mark.parametrize("site_name", maria.all_sites) -def test_get_site(site_name): - site = maria.get_site(site_name) diff --git a/maria/tests/test_sites.py b/maria/tests/test_sites.py index d41520c..7237bc9 100644 --- a/maria/tests/test_sites.py +++ b/maria/tests/test_sites.py @@ -3,16 +3,6 @@ import maria -@pytest.mark.parametrize("instrument_name", maria.all_instruments) -def test_get_instrument(instrument_name): - instrument = maria.get_instrument(instrument_name) - - -@pytest.mark.parametrize("pointing_name", maria.all_pointings) -def test_get_pointing(pointing_name): - pointing = maria.get_pointing(pointing_name) - - @pytest.mark.parametrize("site_name", maria.all_sites) def test_get_site(site_name): site = maria.get_site(site_name) diff --git a/maria/utils/__init__.py b/maria/utils/__init__.py index 3e41a7d..2a23d98 100644 --- a/maria/utils/__init__.py +++ b/maria/utils/__init__.py @@ -43,16 +43,6 @@ def validate_pointing(azim, elev): ) -# def get_pointing_offset(time, period, throws, plan_type): -# if plan_type == "daisy": -# phase = 2 * np.pi * time / period - -# k = np.pi # this added an irrational precession to the daisy -# r = np.sin(k * phase) - -# return throws[0] * r * np.cos(phase), throws[1] * r * np.sin(phase) - - def get_daisy_offsets(phase, k=2.11): r = np.sin(k * phase) return r * np.cos(phase), r * np.sin(phase)