4747 "0a3f2db39d05c44185f6fdeec928089fb55d1ce1e0a805145050c6356cbc6e98" ,
4848 )
4949}
50+ _URL_HASH_CORRECTION_TABLE ["latest" ] = _URL_HASH_CORRECTION_TABLE [10 ]
51+ _URL_HASH_ERROR_TABLE ["latest" ] = _URL_HASH_ERROR_TABLE [3 ]
5052
5153
52- @manager .require ("correction_table_v10" , * _URL_HASH_CORRECTION_TABLE [10 ])
53- def _fetch_correction_table_v10 ():
54- return manager .get ("correction_table_v10" )
54+ @manager .require ("correction_table_latest" , * _URL_HASH_CORRECTION_TABLE ["latest" ])
55+ def _fetch_correction_table_latest ():
56+ return manager .get ("correction_table_latest" )
57+
58+
59+ @manager .require ("error_table_latest" , * _URL_HASH_ERROR_TABLE ["latest" ])
60+ def _fetch_error_table_latest ():
61+ return manager .get ("error_table_latest" )
5562
5663
5764def get_correction_table (source ):
@@ -69,9 +76,9 @@ def get_correction_table(source):
6976 Parameters
7077 ----------
7178 source: pathlib.Path, str
72- The source of the correction table. If it is a `pathlib.Path`, it must be a file.
73- A string file path will error as an invalid source .
74- If source is a string , it must either be "JSOC" which will fetch the most recent version from the JSOC or "SSW" which will fetch the most recent version (V10) from SSW.
79+ The source of the correction table.
80+ It can be a string or `pathlib.Path` for a file .
81+ Otherwise , it must either be "JSOC" which will fetch the most recent version from the JSOC or "SSW" which will fetch the most recent version from SSW.
7582
7683 Returns
7784 -------
@@ -82,17 +89,17 @@ def get_correction_table(source):
8289 --------
8390 aiapy.calibrate.degradation
8491 """
85- if isinstance (source , pathlib .Path ):
86- table = QTable (astropy .io .ascii .read (source ))
87- elif isinstance (source , str ) and source .lower () == "ssw" :
88- table = QTable (astropy .io .ascii .read (_fetch_correction_table_v10 ()))
92+ if isinstance (source , str ) and source .lower () == "ssw" :
93+ table = QTable (astropy .io .ascii .read (_fetch_correction_table_latest ()))
8994 elif isinstance (source , str ) and source .lower () == "jsoc" :
9095 # NOTE: the [!1=1!] disables the drms PrimeKey logic and enables
9196 # the query to find records that are ordinarily considered
9297 # identical because the PrimeKeys for this series are WAVE_STR
9398 # and T_START. Without the !1=1! the query only returns the
9499 # latest record for each unique combination of those keywords.
95100 table = QTable .from_pandas (_get_data_from_jsoc (query = "aia.response[][!1=1!]" , key = "**ALL**" ))
101+ elif isinstance (source , pathlib .Path | str ):
102+ table = QTable (astropy .io .ascii .read (source ))
96103 else :
97104 msg = f"correction_table must be a file path (pathlib.Path), 'JSOC' or 'SSW'. Not { source } "
98105 raise ValueError (msg )
@@ -146,8 +153,9 @@ def _select_epoch_from_correction_table(channel: u.angstrom, obstime, correction
146153 table .sort ("DATE" ) # Newest entries will be last
147154 if len (table ) == 0 :
148155 extra_msg = " Max version is 3." if channel == 4500 * u .AA else ""
156+ msg = f"Correction table does not contain calibration for { channel } .{ extra_msg } "
149157 raise ValueError (
150- f"Correction table does not contain calibration for { channel } ." + extra_msg ,
158+ msg ,
151159 )
152160 # Select the epoch for the given observation time
153161 obstime_in_epoch = np .logical_and (obstime >= table ["T_START" ], obstime < table ["T_STOP" ])
@@ -250,11 +258,6 @@ def get_pointing_table(source, *, time_range=None):
250258 return table
251259
252260
253- @manager .require ("error_table_v3" , * _URL_HASH_ERROR_TABLE [3 ])
254- def _fetch_error_table_v3 ():
255- return manager .get ("error_table_v3" )
256-
257-
258261def get_error_table (source = "SSW" ) -> QTable :
259262 """
260263 Fetches the error table from a SSW mirror or uses a local file if one is
@@ -263,10 +266,9 @@ def get_error_table(source="SSW") -> QTable:
263266 Parameters
264267 ----------
265268 source : pathlib.Path, str, optional
266- If input is a pathlib.Path, it is assumed to be a file path to a local error table.
267- If a path is provided as a string, it will error as an invalid source.
268- Otherwise, the input is allowed to be "SSW" (the default) which will
269- fetch the most recent version (V3) from SSW.
269+ The input is allowed to be "SSW" (the default) which will
270+ fetch the most recent version from SSW.
271+ Otherwise, it must be a file path.
270272
271273 Returns
272274 -------
@@ -278,12 +280,12 @@ def get_error_table(source="SSW") -> QTable:
278280 TypeError
279281 If ``error_table`` is not a file path.
280282 """
281- if isinstance (source , pathlib .Path ):
283+ if isinstance (source , str ) and source .lower () == "ssw" :
284+ error_table = QTable (astropy .io .ascii .read (_fetch_error_table_latest ()))
285+ elif isinstance (source , pathlib .Path | str ):
282286 error_table = QTable (astropy .io .ascii .read (source ))
283- elif isinstance (source , str ) and source .lower () == "ssw" :
284- error_table = QTable (astropy .io .ascii .read (_fetch_error_table_v3 ()))
285287 else :
286- msg = f"source must be a pathlib.Path , or 'SSW', not { source } "
288+ msg = f"source must be a filepath , or 'SSW', not { source } "
287289 raise TypeError (msg )
288290 error_table ["DATE" ] = Time (error_table ["DATE" ], scale = "utc" )
289291 error_table ["T_START" ] = Time (error_table ["T_START" ], scale = "utc" )
0 commit comments