Skip to content

Commit

Permalink
add sites
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Oct 16, 2024
1 parent a103287 commit db627f8
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 60 deletions.
18 changes: 9 additions & 9 deletions maria/coords/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

def dx_dy_to_phi_theta(dx, dy, cphi, ctheta):
"""
A fast and well-conditioned to convert from local dx/dy coordinates to phi/theta coordinates.
A fast and well-conditioned method to convert from local dx/dy coordinates to phi/theta coordinates.
"""

if not dx.shape == dy.shape:
raise ValueError(
f"The shapes of 'dx' and 'dy' must be the same. Got shapes {np.shape(dx)} and {np.shape(dy)}"
)
# if not dx.shape == dy.shape:
# raise ValueError(
# f"The shapes of 'dx' and 'dy' must be the same. Got shapes {np.shape(dx)} and {np.shape(dy)}"
# )

r = np.sqrt(dx**2 + dy**2) # distance from the center
p = np.arctan2(dx, -dy) # 0 at the bottom, increases CCW to pi at the top
Expand All @@ -33,10 +33,10 @@ def phi_theta_to_dx_dy(phi, theta, cphi, ctheta):
A fast and well-conditioned to convert from phi/theta coordinates to local dx/dy coordinates.
"""

if not phi.shape == theta.shape:
raise ValueError(
f"The shapes of 'phi' and 'theta' must be the same. Got shapes {np.shape(phi)} and {np.shape(theta)}"
)
# if not phi.shape == theta.shape:
# raise ValueError(
# f"The shapes of 'phi' and 'theta' must be the same. Got shapes {np.shape(phi)} and {np.shape(theta)}"
# )

dphi = phi - cphi
proj_from_east = (np.cos(dphi) * np.cos(theta) + 1j * np.sin(theta)) * np.exp(
Expand Down
4 changes: 2 additions & 2 deletions maria/instrument/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ def n_dets(self):
# """
# return construct_beam_filter(self.physical_fwhm(z), res, beam_profile=beam_profile, buffer=buffer)

def plot(self):
def plot(self, z=np.inf):
fig, ax = plt.subplots(1, 1, figsize=(5, 5), dpi=160)

fwhms = Angle(self.dets.fwhm)
fwhms = Angle(self.dets.angular_fwhm(z=z))
offsets = Angle(self.dets.offsets)

legend_handles = []
Expand Down
9 changes: 9 additions & 0 deletions maria/instrument/configs/hd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

mini:
aliases: ["cmb-hd-mini"]
array:
n: 250
field_of_view: 9
array_shape: circle
bands: [act/pa5/f150]
primary_size: 30
42 changes: 25 additions & 17 deletions maria/site/regions.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
,location,country,notes,latitude,longitude,altitude,timezone,training_start,training_end,training_years
boolardy,"Boolardy, Western Australia",Australia,"MRO, SKA",-26.697,116.631,395,Australia/Perth,2011-05-06,2024-05-21,12.3
chajnantor,"Llano de Chajnantor, Antofagasta",Chile,"ACT, ALMA, APEX, SO, TAO",-23.006,-67.759,5040,America/Santiago,1962-04-23,2024-05-21,61.4
effelsberg,"Effelsberg, North Rhine-Westphalia",Germany,ERT,50.524,6.883,319,Europe/Berlin,2015-01-01,2024-05-21,9.4
green_bank,"Green Bank, West Virginia",USA,Green Bank Observatory,38.433,-79.84,807,America/New_York,2000-01-22,2024-05-21,24.0
mauna_kea,"Mauna Kea, Hawaii",USA,Mauna Kea Observatory,19.823,-155.475,4205,Pacific/Honolulu,2000-01-04,2024-05-21,24.0
meerkat,"Meerkat National Park, Northern Cape",South Africa,"HERA, MeerKAT, SKA",-30.713,21.443,1075,Africa/Johannesburg,2010-01-01,2024-05-21,14.4
ngari,"Ngari Prefecture, Tibet",China,AliCPT,32.326,80.026,5176,Asia/Shanghai,2010-01-01,2024-05-21,14.4
pic_de_bure,"Plateau de Bure, Haute-Alpes",France,NOEMA,44.634,5.908,2552,Europe/Paris,2015-01-01,2024-05-21,9.4
pico_veleta,"Pico Veleta, Granada",Spain,IRAM,37.066,-3.393,2850,Europe/Madrid,2015-01-01,2024-05-21,9.4
princeton,"Princeton, New Jersey",USA,Princeton University,40.345,-74.651,58,America/New_York,2015-01-01,2024-05-21,9.4
qitai,"Qitai, Xinjiang",China,QTT,43.601,89.699,1780,Asia/Urumqi,2015-01-01,2024-05-21,9.4
san_agustin,"Plains of San Agustín, New Mexico",USA,VLA,34.079,-107.618,2120,America/Denver,2010-01-01,2024-05-21,14.3
san_basilio,"San Basilio, Sardinia",Italy,"SRT, MISTRAL",39.493,9.245,600,Europe/Rome,2011-04-05,2024-05-21,12.0
sierra_negra,"Sierra Negra, Puebla",Mexico,"HAWC, LMT",18.986,-97.314,4640,America/Mexico_City,2012-05-16,2024-05-21,11.4
south_pole,South Pole,Antarctica,"BICEP2, DASI, GML, Keck, SPT",-90.0,0.0,2835,Antarctica/South_Pole,2000-06-20,2024-05-21,23.4
summit_camp,"Summit Station, Greenland",Greenland,Greenland Telescope,72.583,-38.455,3202,America/Nuuk,2007-07-11,2024-05-21,16.2
teide,"Mount Teide, Tenerife",Spain,Teide Observatory,28.301,-16.511,2390,Atlantic/Canary,2010-01-01,2024-05-21,14.4
boolardy,"Boolardy, Western Australia",Australia,"MRO, SKA",-26.697,116.631,395,Australia/Perth,2010-01-01,2024-07-05,14.5
cambridge,"Cambridge, Massachusetts",USA,"Harvard University, MIT",42.374,-71.111,8,America/New_York,2015-01-01,2024-07-05,9.5
chajnantor,"Llano de Chajnantor, Antofagasta",Chile,"ACT, ALMA, APEX, SO, TAO",-23.006,-67.759,5040,America/Santiago,1959-08-17,2024-07-04,64.2
chiang_mai,"Chiang Mai, Thailand",Thailand,TNRT,18.864,99.217,395,Asia/Bangkok,2022-01-01,2024-07-04,1.5
effelsberg,"Effelsberg, North Rhine-Westphalia",Germany,ERT,50.524,6.883,319,Europe/Berlin,2015-01-01,2024-07-04,9.5
green_bank,"Green Bank, West Virginia",USA,Green Bank Observatory,38.433,-79.84,807,America/New_York,2000-01-01,2024-07-04,24.5
mauna_kea,"Mauna Kea, Hawaii",USA,Mauna Kea Observatory,19.823,-155.475,4205,Pacific/Honolulu,2000-01-01,2024-07-05,24.5
meerkat,"Meerkat National Park, Northern Cape",South Africa,"HERA, MeerKAT, SKA",-30.713,21.443,1075,Africa/Johannesburg,2010-01-01,2024-07-04,14.5
metsahovi,"Metsähovi, Kirkkonummi",Finland,Metsähovi Radio Observatory,60.218,24.394,90,Europe/Helsinki,2018-01-01,2024-07-05,5.5
minamimaki,"Minamimaki, Nagano",Japan,Nobeyama Observatory,35.942,138.476,1350,Asia/Tokyo,2015-01-01,2024-07-05,9.5
mount_graham,"Mount Graham, Arizona",USA,"LBT, VATT",32.702,-109.89,3178,America/Phoenix,2015-01-08,2024-07-04,8.9
narrabri,"Narrabri, New South Wales",Australia,ATCA,-30.314,149.562,237,Australia/Sydney,2015-01-01,2024-07-05,9.5
ngari,"Ngari Prefecture, Tibet",China,AliCPT,32.326,80.026,5176,Asia/Shanghai,2010-01-01,2024-07-05,14.5
owens_valley,"Owens Valley, California",USA,Owens Valley Radio Observatory,37.232,-118.295,1222,America/Los_Angeles,2010-01-01,2024-07-04,14.5
pic_de_bure,"Plateau de Bure, Haute-Alpes",France,NOEMA,44.634,5.908,2552,Europe/Paris,2015-01-01,2024-07-05,9.5
pico_veleta,"Pico Veleta, Granada",Spain,IRAM,37.066,-3.393,2850,Europe/Madrid,2015-01-01,2024-07-04,9.5
princeton,"Princeton, New Jersey",USA,Princeton University,40.345,-74.651,58,America/New_York,2015-01-01,2024-07-05,9.5
qitai,"Qitai, Xinjiang",China,QTT,43.601,89.699,1780,Asia/Urumqi,2015-01-01,2024-07-04,9.5
san_agustin,"Plains of San Agustín, New Mexico",USA,VLA,34.079,-107.618,2120,America/Denver,2010-01-01,2024-07-04,14.5
san_basilio,"San Basilio, Sardinia",Italy,"SRT, MISTRAL",39.493,9.245,600,Europe/Rome,2010-01-01,2024-07-05,14.5
sierra_negra,"Sierra Negra, Puebla",Mexico,"HAWC, LMT",18.986,-97.314,4640,America/Mexico_City,2010-01-06,2024-07-04,14.2
south_pole,South Pole,Antarctica,"BICEP2, DASI, GML, Keck, SPT",-90.0,0.0,2835,Antarctica/South_Pole,1996-06-22,2024-07-04,26.5
summit_camp,"Summit Station, Greenland",Greenland,Greenland Telescope,72.583,-38.455,3202,America/Nuuk,2005-10-10,2024-07-05,18.7
teide,"Mount Teide, Tenerife",Spain,Teide Observatory,28.301,-16.511,2390,Atlantic/Canary,2010-01-01,2024-07-04,14.5
thule,Thule Air Base,Greenland,Thule Air Base,76.535,-68.686,77,America/Thule,2023-06-26,2024-07-06,1.0
19 changes: 0 additions & 19 deletions maria/tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
import time

import pytest

import maria
from maria.atmosphere import Atmosphere, AtmosphericSpectrum, Weather
from maria.io import fetch


@pytest.mark.parametrize("region_name", maria.all_regions)
def test_atmosphere(region_name):
Atmosphere(region=region_name)


@pytest.mark.parametrize("region_name", ["chajnantor"])
def test_spectrum_from_cache(region_name):
AtmosphericSpectrum(region=region_name, refresh_cache=True)


@pytest.mark.parametrize("region_name", ["chajnantor"])
def test_weather_from_cache(region_name):
Weather(region=region_name, refresh_cache=True)


@pytest.mark.parametrize("filename", ["cluster.fits"])
def test_maps_from_cache(filename):
fetch(f"maps/{filename}")
12 changes: 12 additions & 0 deletions maria/tests/test_spectrum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import time

import pytest

import maria
from maria.atmosphere import Atmosphere, AtmosphericSpectrum, Weather
from maria.io import fetch


@pytest.mark.parametrize("region_name", ["chajnantor"])
def test_spectrum_from_cache(region_name):
AtmosphericSpectrum(region=region_name, refresh_cache=True)
2 changes: 1 addition & 1 deletion maria/tests/test_weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
def test_weather_from_cache(region_name):
weather = Weather(region=region_name, refresh_cache=True)

weather.pwv
print(f"{weather.pwv = }")
27 changes: 15 additions & 12 deletions maria/utils/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,20 @@ def detrend(D, order=3):
return D - A @ X


def lowpass(data, fc, fs, order=1, method="bessel"):
if method == "bessel":
sos = sp.signal.bessel(
2 * (order + 1), 2 * fc / fs, analog=False, btype="low", output="sos"
)
return sp.signal.sosfilt(sos, data, axis=-1)
def lowpass(data, fc, sample_rate, order=1, axis=-1):
sos = sp.signal.bessel(
2 * (order + 1), 2 * fc / sample_rate, analog=False, btype="low", output="sos"
) # noqa
return sp.signal.sosfilt(sos, data, axis=axis)


def highpass(data, fc, fs, order=1, method="bessel"):
if method == "bessel":
sos = sp.signal.bessel(
2 * (order + 1), 2 * fc / fs, analog=False, btype="high", output="sos"
)
return sp.signal.sosfilt(sos, data, axis=-1)
def highpass(data, fc, sample_rate, order=1, axis=-1):
sos = sp.signal.bessel(
2 * (order + 1), 2 * fc / sample_rate, analog=False, btype="high", output="sos"
) # noqa
return sp.signal.sosfilt(sos, data, axis=axis)


def bandpass(data, f_lower, f_upper, sample_rate, order=1, axis=-1):
kwargs = {"sample_rate": sample_rate, "order": order, "axis": axis} # noqa
return highpass(lowpass(data, f_upper, **kwargs), f_lower, **kwargs) # noqa

0 comments on commit db627f8

Please sign in to comment.