Lv0_fits2dict.py
def fits2dict(fits_file,ext,par_list):
    """
    'Converts' a FITS file to a Python dictionary, with a list of the original
    FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
    but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
    (be it from NICER-data or NICERsoft_outputs or any other mission which has this format)

    fits_file - path to the FITS file
    ext - which extension number; 1 for EVENTS, 2 for GTI, 3 for PPS_TREND
    par_list - A list of parameters we'd like to extract from the FITS file
    (e.g., from eventcl, PI_FAST, TIME, PI)
    """
    if type(fits_file) != str:
        raise TypeError("fits_file should be a string!")
    if type(ext) != int:
        raise TypeError("ext should be an integer!")
    if type(par_list) != list and type(par_list) != np.ndarray:
        raise TypeError("par_list should either be a list or an array!")

    event = fits.open(fits_file)

    fits_dict = {par_list[i]:event[ext].data[par_list[i]] for i in range(len(par_list))}
    #returns a dictionary in the form {'TIME':[array of TIME values],'VARIABLE':[array of VARIABLE values]}

    return fits_dict

    'Converts' a FITS file to a Python dictionary, with a list of the original
    FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
    but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
    (be it from NICER-data or NICERsoft_outputs or any other mission which has this format)

    fits_file - path to the FITS file
    ext - which extension number; 1 for EVENTS, 2 for GTI, 3 for PPS_TREND
    par_list - A list of parameters we'd like to extract from the FITS file
    (e.g., from eventcl, PI_FAST, TIME, PI)
    
'Converts' a FITS file to a Python dictionary, with a list of the original
FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
(be it from NICER-data or NICERsoft_outputs or any other mission which has this format)

path to the FITS file
ext - which extension number; 1 for EVENTS, 2 for GTI, 3 for PPS_TREND
par_list - A list of parameters we'd like to extract from the FITS file
' Converts ' a FITS file to a Python dictionary with a list of the original FITS table ' s columns of the user ' s choosing . Can use this for ANY FITS file but is meant for mkf / orb files in $OBSID_pipe folders from NICER or event files ( be it from NICER - data or NICERsoft_outputs or any other mission which has this format ) path to the FITS file ext - which extension number ; 1 for EVENTS 2 for GTI 3 for PPS_TREND par_list - A list of parameters we ' d like to extract from the FITS file
def fits2dict(fits_file,ext,par_list):
    if type(fits_file) != str:
        raise TypeError("fits_file should be a string!")
    if type(ext) != int:
        raise TypeError("ext should be an integer!")
    if type(par_list) != list and type(par_list) != np.ndarray:
        raise TypeError("par_list should either be a list or an array!")
    event = fits.open(fits_file)
    fits_dict = {par_list[i]:event[ext].data[par_list[i]] for i in range(len(par_list))}
    return fits_dict
def fits2dict ( fits_file , ext , par_list ) : if type ( fits_file ) != str : raise TypeError ( "fits_file should be a string!" ) if type ( ext ) != int : raise TypeError ( "ext should be an integer!" ) if type ( par_list ) != list and type ( par_list ) != np . ndarray : raise TypeError ( "par_list should either be a list or an array!" ) event = fits . open ( fits_file ) fits_dict = { par_list [ i ] : event [ ext ] . data [ par_list [ i ] ] for i in range ( len ( par_list ) ) } return fits_dict
'Converts' a FITS file to a Python dictionary, with a list of the original
FITS table's columns, of the user's choosing.
' Converts ' a FITS file to a Python dictionary with a list of the original FITS table ' s columns of the user ' s choosing .
"""
    'Converts' a FITS file to a Python dictionary, with a list of the original
    FITS table's columns, of the user's choosing. Can use this for ANY FITS file,
    but is meant for mkf/orb files in $OBSID_pipe folders from NICER, or event files
    (be it from NICER-data or NICERsoft_outputs or any other mission which has this format)

    fits_file - path to the FITS file
    ext - which extension number; 1 for EVENTS, 2 for GTI, 3 for PPS_TREND
    par_list - A list of parameters we'd like to extract from the FITS file
    (e.g., from eventcl, PI_FAST, TIME, PI)
    """ #returns a dictionary in the form {'TIME':[array of TIME values],'VARIABLE':[array of VARIABLE values]}
fits_file
ext
par_list