Skip to content

Commit 5d19335

Browse files
committed
merge pipeline control flow changes from sourcefinder testing into main
1 parent 1fb7fd6 commit 5d19335

File tree

3 files changed

+182
-40
lines changed

3 files changed

+182
-40
lines changed

gPhoton/lightcurve/core.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from pathlib import Path
22
from typing import Mapping, Collection
33

4-
import numpy as np
54

65
import gPhoton.constants as c
76
from gPhoton.lightcurve._steps import (
87
find_sources,
98
count_full_depth_image,
109
extract_photometry,
11-
write_exptime_file, load_source_catalog,
10+
write_exptime_file,
11+
load_source_catalog
1212
)
13-
from gPhoton.reference import FakeStopwatch, eclipse_to_paths
13+
from gPhoton.reference import FakeStopwatch
1414
from gPhoton.types import GalexBand
1515

1616

@@ -19,28 +19,23 @@ def make_lightcurves(
1919
eclipse: int,
2020
band: GalexBand,
2121
aperture_sizes: Collection[float],
22-
photonlist_path,
22+
output_filenames,
2323
source_catalog_file=None,
2424
threads=None,
25-
output_filenames=None,
2625
stopwatch: FakeStopwatch = FakeStopwatch(),
2726
):
2827
"""
2928
make lightcurves from preprocessed structures generated from FITS images
3029
and movies, especially ones produced by the gPhoton.moviemaker pipeline.
3130
"""
32-
if output_filenames is None:
33-
output_filenames = eclipse_to_paths(
34-
eclipse, Path(photonlist_path).parent, None
35-
)[band]
3631
if source_catalog_file is not None:
3732
sources = load_source_catalog(source_catalog_file, eclipse)
3833
else:
3934
sources = None
4035
source_table = find_sources(
4136
eclipse,
4237
band,
43-
str(photonlist_path.parent),
38+
str(Path(output_filenames['photomfile']).parent),
4439
sky_arrays["image_dict"],
4540
sky_arrays["wcs"],
4641
source_table=sources,
@@ -60,15 +55,19 @@ def make_lightcurves(
6055
sky_arrays["wcs"],
6156
)
6257
stopwatch.click()
63-
photometry_table = extract_photometry(
64-
sky_arrays["movie_dict"], photometry_table, apertures, threads
65-
)
58+
if len(sky_arrays['movie_dict']) > 0:
59+
photometry_table = extract_photometry(
60+
sky_arrays["movie_dict"], photometry_table, apertures, threads
61+
)
62+
write_exptime_file(
63+
output_filenames["expfile"], sky_arrays["movie_dict"]
64+
)
6665
photomfile = (
6766
f"{output_filenames['photomfile']}"
6867
f"{str(aperture_size).replace('.', '_')}.csv"
6968
)
7069
print(f"writing source table to {photomfile}")
7170
photometry_table.to_csv(photomfile, index=False)
7271
stopwatch.click()
73-
write_exptime_file(output_filenames["expfile"], sky_arrays["movie_dict"])
72+
7473
return "successful"

0 commit comments

Comments
 (0)