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

Accelerate and make more realistic #101

Merged
merged 4 commits into from
Dec 11, 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
10 changes: 7 additions & 3 deletions simpunch/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ def generate_flow(gamera_directory: str,
transient_probability: float = 0.03,
shift_pointing: bool = False,
generate_new: bool = True,
update_database: bool = True) -> None:
generate_full_day: bool = False,
update_database: bool = True,
surrounding_cadence: float = 1.0) -> None:
"""Generate all the products in the reverse pipeline."""
if start_time is None:
start_time = datetime.now() # noqa: DTZ005

if generate_new:
time_delta = timedelta(days=0.1)
time_delta = timedelta(days=surrounding_cadence)
files_tb = sorted(glob.glob(gamera_directory + "/synthetic_cme/*_TB.fits"))
files_pb = sorted(glob.glob(gamera_directory + "/synthetic_cme/*_PB.fits"))

Expand All @@ -45,7 +47,9 @@ def generate_flow(gamera_directory: str,
for td in np.linspace(1, 30, int(timedelta(days=30)/time_delta))]
generate_l3_all_fixed(gamera_directory, output_directory, next_month, files_pb[-1], files_tb[-1])

generate_l3_all(gamera_directory, output_directory, start_time, num_repeats=num_repeats)
if generate_full_day:
generate_l3_all(gamera_directory, output_directory, start_time, num_repeats=num_repeats)

generate_l2_all(gamera_directory, output_directory)
generate_l1_all(gamera_directory, output_directory)
generate_l0_all(gamera_directory,
Expand Down
3 changes: 2 additions & 1 deletion simpunch/level0.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generate synthetic level 0 data."""
import copy
import glob
import os
from pathlib import Path
Expand Down Expand Up @@ -95,7 +96,7 @@ def starfield_misalignment(input_data: NDCube,
cr_offset_scale: float = 0.1,
pc_offset_scale: float = 0.1) -> NDCube:
"""Offset the pointing in an image to simulate spacecraft uncertainty."""
original_wcs = input_data.wcs.copy()
original_wcs = copy.deepcopy(input_data.wcs)
cr_offsets = np.random.normal(0, cr_offset_scale, 2)
input_data.wcs.wcs.crval = input_data.wcs.wcs.crval + cr_offsets

Expand Down
2 changes: 1 addition & 1 deletion simpunch/level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def add_starfield_clear(input_data: NDCube) -> NDCube:
input_data.data.shape)

starfield, stars = generate_starfield(wcs_stellar_input, input_data.data[:, :].shape,
flux_set=100*2.0384547E-9,
flux_set=30*2.0384547E-9,
fwhm=3, dimmest_magnitude=12,
noise_mean=None, noise_std=None)

Expand Down
Loading