This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| 
                    data:data_analysis_manual:read_catalog_python [2022/08/30 18:20] eric buchlin Read catalog included in releases  | 
                
                    data:data_analysis_manual:read_catalog_python [2024/03/29 14:11] (current) eric buchlin Page is deprecated  | 
            ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== How to read and use the UiO FITS files catalog in Python ====== | ====== How to read and use the UiO FITS files catalog in Python ====== | ||
| + | |||
| + | <note warning>These scripts are deprecated in favor of the current version, available in the [[https://sospice.readthedocs.io/en/stable/|sospice Python module]].</note> | ||
| ===== CSV catalog (new, recommended) ===== | ===== CSV catalog (new, recommended) ===== | ||
| - | <file python read_uio_cat.py> | + | <file python read_uio_cat_csv.py> | 
| from pathlib import Path | from pathlib import Path | ||
| import pandas as pd | import pandas as pd | ||
| Line 28: | Line 30: | ||
| Table | Table | ||
| """ | """ | ||
| - | cat_file = Path(data_path) / "fits" / "spice_catalog.txt" | + | cat_file = Path(data_path) / "fits" / "spice_catalog.csv" | 
| if not cat_file.exists(): | if not cat_file.exists(): | ||
| print(f'Error: Catalog file not available at {cat_file.as_posix()}') | print(f'Error: Catalog file not available at {cat_file.as_posix()}') | ||
| sys.exit(1) | sys.exit(1) | ||
| date_columns = ['DATE-BEG','DATE', 'TIMAQUTC'] | date_columns = ['DATE-BEG','DATE', 'TIMAQUTC'] | ||
| - | df = pd.read_table(cat_file, parse_dates=date_columns, date_parser=date_parser) | + | df = pd.read_csv(cat_file, parse_dates=date_columns, date_parser=date_parser) | 
| return df | return df | ||
| </file> | </file> | ||
| Line 60: | Line 62: | ||
| ===== Text catalog ===== | ===== Text catalog ===== | ||
| - | <file python read_uio_cat.py> | + | <file python read_uio_cat_txt.py> | 
| from pathlib import Path | from pathlib import Path | ||
| import pandas as pd | import pandas as pd | ||