@@ -114,8 +114,7 @@ def get_tic_id_and_sector_from_file_path(path: Union[Path, str]) -> (int, Union[
114
114
:param path: The path of the file to extract the TIC ID and sector.
115
115
:return: The TIC ID and sector. The sector might be omitted (as None).
116
116
"""
117
- if isinstance (path , Path ):
118
- path = str (path )
117
+ path = str (Path (path ))
119
118
# Search for Brian Powell's FFI path convention with directory structure sector, magnitude, target.
120
119
# E.g., "tesslcs_sector_12/tesslcs_tmag_1_2/tesslc_290374453"
121
120
match = re .search (r'tesslcs_sector_(\d+)(?:_104)?/(?:2_min_cadence_targets|tesslcs_tmag_\d+_\d+)/tesslc_(\d+)' , path )
@@ -141,14 +140,13 @@ def get_floor_magnitude_from_file_path(file_path: Union[Path, str]) -> int:
141
140
:param file_path: The path of the file to extract the magnitude.
142
141
:return: The magnitude floored.
143
142
"""
144
- if isinstance (file_path , Path ):
145
- file_path = str (file_path )
143
+ file_path_string = str (Path (file_path ))
146
144
# Search for Brian Powell's FFI path convention with directory structure sector, magnitude, target.
147
145
# E.g., "tesslcs_sector_12/tesslcs_tmag_1_2/tesslc_290374453"
148
- match = re .search (r'tesslcs_sector_\d+(?:_104)?/tesslcs_tmag_(\d+)_\d+/tesslc_\d+' , file_path )
146
+ match = re .search (r'tesslcs_sector_\d+(?:_104)?/tesslcs_tmag_(\d+)_\d+/tesslc_\d+' , file_path_string )
149
147
if match :
150
148
return int (match .group (1 ))
151
- raise ValueError (f'{ file_path } does not match a known pattern to extract magnitude from.' )
149
+ raise ValueError (f'{ file_path_string } does not match a known pattern to extract magnitude from.' )
152
150
153
151
@staticmethod
154
152
def get_magnitude_from_file (file_path : Union [Path , str ]) -> float :
0 commit comments