Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better array generation #58

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion maria/atmosphere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from .. import utils
from ..constants import k_B
from ..plan import validate_pointing
from ..sim.base import BaseSimulation
from ..site import InvalidRegionError, all_regions
from .turbulent_layer import TurbulentLayer
Expand Down Expand Up @@ -92,7 +93,7 @@ def _initialize_atmosphere(self):
This assume that BaseSimulation.__init__() has been called.
"""

utils.validate_pointing(self.det_coords.az, self.det_coords.el)
validate_pointing(self.det_coords.az, self.det_coords.el)

if self.atmosphere_model == "2d":
self.turbulent_layer_depths = np.linspace(
Expand Down
6 changes: 3 additions & 3 deletions maria/atmosphere/turbulent_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def __init__(
]

# find the detector offsets which form a convex hull
self.detector_offsets = np.c_[
self.instrument.offset_x, self.instrument.offset_y
]
self.detector_offsets = np.radians(
np.c_[self.instrument.sky_x, self.instrument.sky_y]
)

# add a small circle of offsets to account for pesky zeros
unit_circle_complex = np.exp(1j * np.linspace(0, 2 * np.pi, 64 + 1)[:-1])
Expand Down
15 changes: 15 additions & 0 deletions maria/coords/coords.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Simple C program to display "Hello World"

// Header file for input output functions
#include <stdio.h>

// main function -
// where the execution of program begins
int main()
{

// prints hello world
printf("Hello World");

return 0;
}
23 changes: 9 additions & 14 deletions maria/instrument/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .. import utils
from .bands import BandList # noqa F401
from .beams import compute_angular_fwhm, construct_beam_filter # noqa F401
from .dets import Detectors # noqa F401
from .detectors import Detectors # noqa F401

HEX_CODE_LIST = [
mpl.colors.to_hex(mpl.colormaps.get_cmap("Paired")(t))
Expand Down Expand Up @@ -63,11 +63,10 @@ class Instrument:
An instrument.
"""

description: str = ""
description: str = "An instrument."
primary_size: float = None # in meters
field_of_view: float = None # in deg
baseline: float = None
bath_temp: float = None
bands: BandList = None
dets: pd.DataFrame = None # dets, it's complicated
documentation: str = ""
Expand All @@ -84,12 +83,8 @@ def from_config(cls, config):

return cls(bands=dets.bands, dets=dets, **config)

# def __post_init__(self):

# if self.baseline is None:
# unique_baselines = sorted(np.unique(self.dets.baseline))

# ...
def __post_init__(self):
self.field_of_view = np.round(self.dets.sky_x.ptp(), 3)

def __repr__(self):
nodef_f_vals = (
Expand All @@ -110,16 +105,16 @@ def ubands(self):
return self.dets.bands.names

@property
def offset_x(self):
return self.dets.offset_x
def sky_x(self):
return self.dets.sky_x

@property
def offset_y(self):
return self.dets.offset_y
def sky_y(self):
return self.dets.sky_y

@property
def offsets(self):
return np.c_[self.offset_x, self.offset_y]
return np.c_[self.sky_x, self.sky_y]

@property
def baseline_x(self):
Expand Down
Loading
Loading