-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a619c26
commit c9f4a12
Showing
218 changed files
with
50,252 additions
and
22 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 4c494d747a2a3309a821e12e38277420 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file added
BIN
+148 KB
docs/build/html/_downloads/0c513417754328995f29c097b59265ce/thermalgain_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+442 KB
...ild/html/_downloads/10c1d16889c045ddb83df88beba2aa51/thermalgain_demo.hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
docs/build/html/_downloads/1a23db2426a59e7579e865ba811a62e2/spacecraft_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import numpy as np | ||
import litebird_sim as lbs | ||
from astropy.time import Time | ||
import matplotlib.pylab as plt | ||
|
||
orbit = lbs.SpacecraftOrbit(start_time=Time("2023-01-01")) | ||
|
||
posvel = lbs.spacecraft_pos_and_vel( | ||
orbit, | ||
start_time=orbit.start_time, | ||
time_span_s=3.15e7, # One year | ||
delta_time_s=86_400.0, # One day | ||
) | ||
|
||
# posvel.positions_km is a N×3 array containing the XYZ position | ||
# of the spacecraft calculated every day for one year. We compute | ||
# the modulus of the position, which is of course the | ||
# Sun-LiteBIRD distance. | ||
sun_distance_km = np.linalg.norm(posvel.positions_km, axis=1) | ||
|
||
# We do the same with the velocities | ||
speed_km_s = np.linalg.norm(posvel.velocities_km_s, axis=1) | ||
|
||
# Plot distance and speed as functions of time | ||
_, ax = plt.subplots(nrows=2, ncols=1, figsize=(7, 7)) | ||
|
||
ax[0].plot(sun_distance_km) | ||
ax[0].set_xlabel("Day") | ||
ax[0].set_ylabel("Distance [km]") | ||
|
||
ax[1].plot(speed_km_s) | ||
ax[1].set_xlabel("Day") | ||
ax[1].set_ylabel("Speed [km/s]") |
Binary file added
BIN
+269 KB
docs/build/html/_downloads/1d737c7888c940f957b5e5b7f9b6c376/dipole_demo.hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.4 KB
docs/build/html/_downloads/24922bc47ca45a6c04ef342c5a856d8b/dipole_demo.pdf
Binary file not shown.
96 changes: 96 additions & 0 deletions
96
docs/build/html/_downloads/2c527c73c72e71d690b18bccd1971129/thermalgain_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import numpy as np | ||
import litebird_sim as lbs | ||
from astropy.time import Time | ||
import matplotlib.pyplot as plt | ||
|
||
start_time = Time("2034-05-02") | ||
duration_s = 100 | ||
sampling_freq_Hz = 1 | ||
|
||
# Creating a list of detectors. The three detectors belong to two | ||
# different wafer groups. | ||
dets = [ | ||
lbs.DetectorInfo( | ||
name="det_A_wafer_1", sampling_rate_hz=sampling_freq_Hz, wafer="wafer_1" | ||
), | ||
lbs.DetectorInfo( | ||
name="det_B_wafer_1", sampling_rate_hz=sampling_freq_Hz, wafer="wafer_1" | ||
), | ||
lbs.DetectorInfo( | ||
name="det_C_wafer_2", sampling_rate_hz=sampling_freq_Hz, wafer="wafer_2" | ||
), | ||
] | ||
|
||
# Defining the gain drift simulation parameters with no detector mismatch | ||
drift_params_no_mismatch = lbs.GainDriftParams( | ||
drift_type=lbs.GainDriftType.THERMAL_GAIN, | ||
focalplane_group="wafer", | ||
detector_mismatch=0.0, | ||
) | ||
|
||
# Defining the gain drift simulation parameters with detector mismatch | ||
drift_params_with_mismatch = lbs.GainDriftParams( | ||
drift_type=lbs.GainDriftType.THERMAL_GAIN, | ||
focalplane_group="wafer", | ||
detector_mismatch=1.0, | ||
) | ||
|
||
sim1 = lbs.Simulation( | ||
start_time=start_time, | ||
duration_s=duration_s, | ||
random_seed=12345, | ||
) | ||
|
||
sim1.create_observations( | ||
detectors=dets, | ||
split_list_over_processes=False, | ||
num_of_obs_per_detector=1, | ||
) | ||
|
||
sim1.observations[0].thermalgain_tod_no_mismatch = np.ones_like( | ||
sim1.observations[0].tod | ||
) | ||
sim1.observations[0].thermalgain_tod_with_mismatch = np.ones_like( | ||
sim1.observations[0].tod | ||
) | ||
|
||
# Generating the gain drift factors with no detector mismatch | ||
sim1.apply_gaindrift( | ||
drift_params=drift_params_no_mismatch, | ||
component="thermalgain_tod_no_mismatch", | ||
user_seed=12345, | ||
) | ||
|
||
# Generating the gain drift factors with detector mismatch | ||
sim1.apply_gaindrift( | ||
drift_params=drift_params_with_mismatch, | ||
component="thermalgain_tod_with_mismatch", | ||
user_seed=12345, | ||
) | ||
|
||
plt.figure(figsize=(8, 10)) | ||
|
||
plt.subplot(211) | ||
for idx in range(sim1.observations[0].tod.shape[0]): | ||
plt.plot( | ||
sim1.observations[0].thermalgain_tod_no_mismatch[idx], | ||
label=sim1.observations[0].name[idx], | ||
) | ||
|
||
plt.xlabel("Time (in seconds)") | ||
plt.ylabel("Linear gain factor amplitude") | ||
plt.title("Thermal gain drift factor with no detector mismatch") | ||
plt.legend() | ||
|
||
plt.subplot(212) | ||
for idx in range(sim1.observations[0].tod.shape[0]): | ||
plt.plot( | ||
sim1.observations[0].thermalgain_tod_with_mismatch[idx], | ||
label=sim1.observations[0].name[idx], | ||
) | ||
|
||
plt.xlabel("Time (in seconds)") | ||
plt.ylabel("Linear gain factor amplitude") | ||
plt.title("Thermal gain drift factor with detector mismatch") | ||
plt.legend() | ||
plt.tight_layout() |
Binary file added
BIN
+29.8 KB
docs/build/html/_downloads/3c7f580fe11f6ae3b6b2537ebb1e5707/bandpass_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.5 KB
docs/build/html/_downloads/4cd1b70cc4ca892052d924dadee24f11/bandpass_demo.pdf
Binary file not shown.
24 changes: 24 additions & 0 deletions
24
docs/build/html/_downloads/57cb5d5e5a03f83dcbbc60b5819d0a7a/bandpass_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import litebird_sim as lbs | ||
import matplotlib.pylab as plt | ||
|
||
# Generate the «model» (i.e., ideal band, with no wiggles) | ||
band = lbs.BandPassInfo( | ||
bandcenter_ghz=43.0, | ||
bandwidth_ghz=10.0, | ||
bandtype="top-hat-cosine", | ||
normalize=True, | ||
nsamples_inband=100, | ||
) | ||
plt.plot(band.freqs_ghz, band.weights, label="Ideal band") | ||
|
||
# Now generate a more realistic band with random wiggles | ||
new_weights = band.bandpass_resampling() | ||
plt.plot( | ||
band.freqs_ghz, | ||
new_weights, | ||
label="Random realization", | ||
) | ||
|
||
plt.xlabel("Frequency [GHz]") | ||
plt.ylabel("Weight") | ||
plt.legend() |
Binary file added
BIN
+42.4 KB
docs/build/html/_downloads/7c01310eac947c15d269f4ed7100811c/lingain_demo.pdf
Binary file not shown.
Binary file added
BIN
+115 KB
docs/build/html/_downloads/8f658199a3d3cac5ea13995d60bf5bf5/lingain_demo.hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions
61
docs/build/html/_downloads/96d1d92116c317651ba8d0c45fe2859c/lingain_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import numpy as np | ||
import litebird_sim as lbs | ||
from astropy.time import Time | ||
import matplotlib.pyplot as plt | ||
|
||
start_time = Time("2034-05-02") | ||
duration_s = 4 * 24 * 3600 | ||
sampling_freq_Hz = 1 | ||
|
||
# Creating a list of detectors. | ||
dets = [ | ||
lbs.DetectorInfo( | ||
name="det_A_wafer_1", sampling_rate_hz=sampling_freq_Hz, wafer="wafer_1" | ||
), | ||
lbs.DetectorInfo( | ||
name="det_B_wafer_1", sampling_rate_hz=sampling_freq_Hz, wafer="wafer_1" | ||
), | ||
] | ||
|
||
# Defining the gain drift simulation parameters | ||
drift_params = lbs.GainDriftParams( | ||
drift_type=lbs.GainDriftType.LINEAR_GAIN, | ||
calibration_period_sec=24 * 3600, | ||
) | ||
|
||
sim1 = lbs.Simulation( | ||
start_time=start_time, | ||
duration_s=duration_s, | ||
random_seed=12345, | ||
) | ||
|
||
sim1.create_observations( | ||
detectors=dets, | ||
split_list_over_processes=False, | ||
num_of_obs_per_detector=1, | ||
) | ||
|
||
sim1.observations[0].lingain_tod = np.ones_like(sim1.observations[0].tod) | ||
|
||
# Applying gain drift using the `Simulation` class method | ||
sim1.apply_gaindrift( | ||
drift_params=drift_params, | ||
component="lingain_tod", | ||
) | ||
|
||
plt.figure(figsize=(8, 5)) | ||
|
||
time_domain = ( | ||
np.arange(sim1.observations[0].tod.shape[1]) / sampling_freq_Hz / 24 / 3600 | ||
) | ||
|
||
for idx in range(sim1.observations[0].tod.shape[0]): | ||
plt.plot( | ||
time_domain, | ||
sim1.observations[0].lingain_tod[idx], | ||
label=sim1.observations[0].name[idx], | ||
) | ||
|
||
plt.xlabel("Time (in days)") | ||
plt.ylabel("Linear gain factor amplitude") | ||
plt.legend() |
Binary file added
BIN
+91.8 KB
.../build/html/_downloads/97eedd704b5c69d06e0c8099efc36685/bandpass_demo.hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.6 KB
docs/build/html/_downloads/b003556039a3163cc1458edbb410683a/thermalgain_demo.pdf
Binary file not shown.
Binary file added
BIN
+35.3 KB
docs/build/html/_downloads/b1ff4303533b13878146528f9ad738d1/lingain_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.3 KB
docs/build/html/_downloads/bdc082ba2af4303a964695b790258f9c/spacecraft_demo.pdf
Binary file not shown.
Binary file added
BIN
+31.3 KB
docs/build/html/_downloads/c801375eacf27ac75efaedee3f62e2c2/spacecraft_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions
69
docs/build/html/_downloads/db9d2aed004b9cdb4001394d56adf8c2/dipole_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from astropy.time import Time | ||
import numpy as np | ||
import litebird_sim as lbs | ||
import matplotlib.pylab as plt | ||
|
||
start_time = Time("2022-01-01") | ||
time_span_s = 120.0 # Two minutes | ||
sampling_hz = 20 | ||
|
||
sim = lbs.Simulation(start_time=start_time, duration_s=time_span_s, random_seed=12345) | ||
|
||
# We pick a simple scanning strategy where the spin axis is aligned | ||
# with the Sun-Earth axis, and the spacecraft spins once every minute | ||
sim.set_scanning_strategy( | ||
lbs.SpinningScanningStrategy( | ||
spin_sun_angle_rad=np.deg2rad(0), | ||
precession_rate_hz=0, | ||
spin_rate_hz=1 / 60, | ||
start_time=start_time, | ||
), | ||
delta_time_s=5.0, | ||
) | ||
|
||
# We simulate an instrument whose boresight is perpendicular to | ||
# the spin axis. | ||
sim.set_instrument( | ||
lbs.InstrumentInfo( | ||
boresight_rotangle_rad=0.0, | ||
spin_boresight_angle_rad=np.deg2rad(90), | ||
spin_rotangle_rad=np.deg2rad(75), | ||
) | ||
) | ||
|
||
# A simple detector looking along the boresight direction | ||
det = lbs.DetectorInfo( | ||
name="Boresight_detector", | ||
sampling_rate_hz=sampling_hz, | ||
bandcenter_ghz=100.0, | ||
) | ||
|
||
(obs,) = sim.create_observations(detectors=[det]) | ||
|
||
sim.prepare_pointings() | ||
|
||
# Simulate the orbit of the spacecraft and compute positions and | ||
# velocities | ||
orbit = lbs.SpacecraftOrbit(obs.start_time) | ||
pos_vel = lbs.spacecraft_pos_and_vel(orbit, obs, delta_time_s=60.0) | ||
|
||
t = obs.get_times() | ||
t -= t[0] # Make `t` start from zero | ||
|
||
# Create two plots: the first shows the full two-minute time span, and | ||
# the second one shows a zoom over the very first points of the TOD. | ||
_, axes = plt.subplots(nrows=2, ncols=1, figsize=(10, 12)) | ||
|
||
# Make a plot of the TOD using all the dipole types | ||
for type_idx, dipole_type in enumerate(lbs.DipoleType): | ||
obs.tod[0][:] = 0 # Reset the TOD | ||
lbs.add_dipole_to_observations(obs, pos_vel, dipole_type=dipole_type) | ||
|
||
axes[0].plot(t, obs.tod[0], label=str(dipole_type)) | ||
axes[1].plot(t[0:20], obs.tod[0][0:20], label=str(dipole_type)) | ||
|
||
axes[0].set_xlabel("Time [s]") | ||
axes[0].set_ylabel("Signal [K]") | ||
axes[1].set_xlabel("Time [s]") | ||
axes[1].set_ylabel("Signal [K]") | ||
axes[1].legend() |
Binary file added
BIN
+105 KB
...uild/html/_downloads/f8704f44ef47aebc8d1644b811851eb1/spacecraft_demo.hires.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+83.9 KB
docs/build/html/_downloads/fd61824b95cfd15e67ffbfd2efd491a6/dipole_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.