66import numpy as np
77from astropy .coordinates import SkyCoord
88from astropy .io .fits import HDUList
9+ from astropy .utils .decorators import deprecated_renamed_argument
910from astropy .table import Table
1011
1112from . import log
@@ -35,7 +36,9 @@ class TessFootprintCutout(FootprintCutout):
3536 cutouts will be generated from all sequences that contain the cutout.
3637 For the TESS mission, this parameter corresponds to sectors.
3738 product : str, optional
38- Default 'SPOC'. The product type to make the cutouts from.
39+ .. deprecated:: 1.1.0
40+ This parameter is deprecated and will be removed in a future release.
41+ Only "SPOC" products are now supported.
3942 verbose : bool
4043 If True, log messages are printed to the console.
4144
@@ -62,25 +65,24 @@ class TessFootprintCutout(FootprintCutout):
6265 Write the cutouts as Target Pixel Files (TPFs) to the specified directory.
6366 """
6467
68+ @deprecated_renamed_argument ('product' , None , since = '1.1.0' , message = 'Astrocut no longer supports cutouts from '
69+ 'TESS Image Calibrator (TICA) products. '
70+ 'The `product` argument is deprecated and will be removed in a future version.' )
6571 def __init__ (self , coordinates : Union [SkyCoord , str ],
6672 cutout_size : Union [int , np .ndarray , u .Quantity , List [int ], Tuple [int ]] = 25 ,
6773 fill_value : Union [int , float ] = np .nan , limit_rounding_method : str = 'round' ,
6874 sequence : Union [int , List [int ], None ] = None , product : str = 'SPOC' , verbose : bool = False ):
6975 super ().__init__ (coordinates , cutout_size , fill_value , limit_rounding_method , sequence , verbose )
7076
7177 # Validate and set the product
72- if product .upper () not in [ 'SPOC' , 'TICA' ] :
73- raise InvalidInputError ('Product for TESS cube cutouts must be either "SPOC" or "TICA ".' )
74- self ._product = product . upper ()
78+ if product .upper () != 'SPOC' :
79+ raise InvalidInputError ('Product for TESS cube cutouts must be "SPOC".' )
80+ self ._product = 'SPOC'
7581 self ._arcsec_per_px = 21 # Number of arcseconds per pixel in a TESS image
7682
77- # Set S3 URIs to footprint cache file and base file path based on product
78- if self ._product == 'SPOC' :
79- self ._s3_footprint_cache = 's3://stpubdata/tess/public/footprints/tess_ffi_footprint_cache.json'
80- self ._s3_base_file_path = 's3://stpubdata/tess/public/mast/'
81- else :
82- self ._s3_footprint_cache = 's3://stpubdata/tess/public/footprints/tica_ffi_footprint_cache.json'
83- self ._s3_base_file_path = 's3://stpubdata/tess/public/mast/tica/'
83+ # Set S3 URIs to footprint cache file and base file path
84+ self ._s3_footprint_cache = 's3://stpubdata/tess/public/footprints/tess_ffi_footprint_cache.json'
85+ self ._s3_base_file_path = 's3://stpubdata/tess/public/mast/'
8486
8587 # Make the cutouts upon initialization
8688 self .cutout ()
@@ -99,14 +101,8 @@ def _extract_sequence_information(self, sector_name: str) -> dict:
99101 dict
100102 A dictionary containing the sector name, sector number, camera number, and CCD number.
101103 """
102- # Define the pattern based on the product
103- if self ._product == 'SPOC' :
104- pattern = re .compile (r"(tess-s)(?P<sector>\d{4})-(?P<camera>\d{1,4})-(?P<ccd>\d{1,4})" )
105- elif self ._product == 'TICA' :
106- pattern = re .compile (r"(hlsp_tica_s)(?P<sector>\d{4})-(cam)(?P<camera>\d{1,4})-(ccd)(?P<ccd>\d{1,4})" )
107- else :
108- # Return an empty dictionary if the product is not recognized
109- return {}
104+ # Example sector name format: "tess-s0001-4-4"
105+ pattern = re .compile (r"(tess-s)(?P<sector>\d{4})-(?P<camera>\d{1,4})-(?P<ccd>\d{1,4})" )
110106 sector_match = re .match (pattern , sector_name )
111107
112108 if not sector_match :
@@ -118,10 +114,6 @@ def _extract_sequence_information(self, sector_name: str) -> dict:
118114 camera = sector_match .group ("camera" )
119115 ccd = sector_match .group ("ccd" )
120116
121- # Rename the TICA sector because of the naming convention in Astrocut
122- if self ._product == 'TICA' :
123- sector_name = f"tica-s{ sector } -{ camera } -{ ccd } "
124-
125117 return {"sectorName" : sector_name , "sector" : sector , "camera" : camera , "ccd" : ccd }
126118
127119 def _create_sequence_list (self , observations : Table ) -> List [dict ]:
@@ -139,8 +131,7 @@ def _create_sequence_list(self, observations: Table) -> List[dict]:
139131 A list of dictionaries, each containing the sector name, sector number, camera number, and CCD number.
140132 """
141133 # Filter observations by target name to get only the FFI observations
142- target_name = "TESS FFI" if self ._product == 'SPOC' else "TICA FFI"
143- obs_filtered = [obs for obs in observations if obs ["target_name" ].upper () == target_name ]
134+ obs_filtered = [obs for obs in observations if obs ["target_name" ].upper () == "TESS FFI" ]
144135
145136 sequence_results = []
146137 for row in obs_filtered :
@@ -220,7 +211,7 @@ def cutout(self):
220211 input_files = [f"{ self ._s3_base_file_path } { file ['cube' ]} " for file in files_mapping ]
221212 tess_cube_cutout = TessCubeCutout (input_files , self ._coordinates , self ._cutout_size ,
222213 self ._fill_value , self ._limit_rounding_method , threads = 8 ,
223- product = self . _product , verbose = self ._verbose )
214+ verbose = self ._verbose )
224215
225216 # Assign attributes from the TessCubeCutout object
226217 self .tess_cube_cutout = tess_cube_cutout
@@ -244,8 +235,11 @@ def write_as_tpf(self, output_dir: Union[str, Path] = '.') -> List[str]:
244235 List of file paths to cutout target pixel files.
245236 """
246237 return self .tess_cube_cutout .write_as_tpf (output_dir )
247-
248238
239+
240+ @deprecated_renamed_argument ('product' , None , since = '1.1.0' , message = 'Astrocut no longer supports cutouts from '
241+ 'TESS Image Calibrator (TICA) products. '
242+ 'The `product` argument is deprecated and will be removed in a future version.' )
249243def cube_cut_from_footprint (coordinates : Union [str , SkyCoord ], cutout_size ,
250244 sequence : Union [int , List [int ], None ] = None , product : str = 'SPOC' ,
251245 memory_only = False , output_dir : str = '.' ,
@@ -273,7 +267,9 @@ def cube_cut_from_footprint(coordinates: Union[str, SkyCoord], cutout_size,
273267 cutouts will be generated from all sequences that contain the cutout.
274268 For the TESS mission, this parameter corresponds to sectors.
275269 product : str, optional
276- Default 'SPOC'. The product type to make the cutouts from.
270+ .. deprecated:: 1.1.0
271+ This parameter is deprecated and will be removed in a future release.
272+ Only "SPOC" products are now supported.
277273 memory_only : bool, optional
278274 Default False. If True, the cutouts are stored in memory and not written to disk.
279275 output_dir : str, optional
@@ -295,7 +291,6 @@ def cube_cut_from_footprint(coordinates: Union[str, SkyCoord], cutout_size,
295291 ... coordinates='83.40630967798376 -62.48977125108528',
296292 ... cutout_size=64,
297293 ... sequence=[1, 2], # TESS sectors
298- ... product='SPOC',
299294 ... output_dir='./cutouts')
300295 ['./cutouts/tess-s0001-4-4/tess-s0001-4-4_83.406310_-62.489771_64x64_astrocut.fits',
301296 './cutouts/tess-s0002-4-1/tess-s0002-4-1_83.406310_-62.489771_64x64_astrocut.fits']
0 commit comments