Skip to content

Commit

Permalink
rename module, use same thread number for cube_cut
Browse files Browse the repository at this point in the history
  • Loading branch information
snbianco committed Sep 19, 2024
1 parent be097ff commit abd5eb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion astrocut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ class UnsupportedPythonError(Exception):
from .cutout_processing import (path_to_footprints, center_on_path, # noqa
CutoutsCombiner, build_default_combine_function) # noqa
from .asdf_cutouts import asdf_cut, get_center_pixel # noqa
from .cube_cut_from_footprint import cube_cut_from_footprint # noqa
from .footprint_cutouts import cube_cut_from_footprint # noqa
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _get_cube_files_from_sequence_obs(sequences: list):


def cube_cut_from_footprint(coordinates: Union[str, SkyCoord], cutout_size,
sequences: Union[int, List[int], None] = None, product: str = 'SPOC',
sequence: Union[int, List[int], None] = None, product: str = 'SPOC',
output_dir: str = '.', threads: Union[int, Literal['auto']] = 1,
verbose: bool = False):
"""
Expand All @@ -195,7 +195,7 @@ def cube_cut_from_footprint(coordinates: Union[str, SkyCoord], cutout_size,
order. Scalar numbers in ``cutout_size`` are assumed to be in
units of pixels. `~astropy.units.Quantity` objects must be in pixel or
angular units.
sequences : int, List[int], optional
sequence : int, List[int], optional
Default None. Sequence(s) from which to generate cutouts. Can provide a single
sequence number as an int or a list of sequence numbers. If not specified,
cutouts will be generated from all sequences that contain the cutout.
Expand Down Expand Up @@ -236,18 +236,18 @@ def cube_cut_from_footprint(coordinates: Union[str, SkyCoord], cutout_size,
print(f'Found {len(all_ffis)} footprint files.')

# Filter FFIs by provided sectors
if sequences and product:
if sequence and product:
# Convert to list
if isinstance(sequences, int):
sequences = [sequences]
all_ffis = all_ffis[np.isin(all_ffis['sequence_number'], sequences)]
if isinstance(sequence, int):
sequence = [sequence]
all_ffis = all_ffis[np.isin(all_ffis['sequence_number'], sequence)]

if len(all_ffis) == 0:
raise InvalidQueryError(f'No FFI cube files were found for sequences: \
{", ".join(str(s) for s in sequences)}')
{", ".join(str(s) for s in sequence)}')

if verbose:
print(f'Filtered to {len(all_ffis)} footprints for sequences: {", ".join(str(s) for s in sequences)}')
print(f'Filtered to {len(all_ffis)} footprints for sequences: {", ".join(str(s) for s in sequence)}')

# Get sector names and cube files that contain the cutout
cone_results = _ra_dec_crossmatch(all_ffis, coordinates, cutout_size, TESS_ARCSEC_PER_PX)
Expand Down Expand Up @@ -276,7 +276,7 @@ def process_file(file):
cutout_size=cutout_size,
product=product,
output_path=output_path,
threads='auto',
threads=threads,
verbose=verbose
)
return cutout
Expand Down

0 comments on commit abd5eb9

Please sign in to comment.