Get Spacecraft Parameters (lexi.get_spc_prams)

lexi_xray.lexi.get_spc_prams(time_range=None, time_zone='UTC', time_step=1, time_pad=300, data_clip=True, interp_method='linear', verbose=True, lexi_data=False, return_data_type='merged', lexi_data_kwargs=None)[source]

Function to get spacecraft ephemeris data

Parameters

time_rangelist, required

Time range to consider. [start time, end time]. Times can be expressed in the following formats:

  1. A string in the format ‘YYYY-MM-DDTHH:MM:SS’ (e.g. ‘2022-01-01T00:00:00’)

  2. A datetime object

  3. A float in the format of a UNIX timestamp (e.g. 1640995200.0)

This time range defines the time range of the ephemeris data and the time range of he LEXI data.

Note

The endpoints are inclusive (the end time is a closed interval); this is because he time range slicing is done with pandas, and label slicing in pandas is inclusive.

time_zonestr, optional

The timezone of the time range of interest. Default is “UTC”

time_stepint or float, optional

Time step in seconds for time resolution of the look direction datum.

time_padfloat, optional

Time padding in seconds to add to the time range value. Default is 300 seconds

data_clipbool, optional

If True, clip the data to the original time range specified, else, keep the entire dataframe. Default is True

interp_methodstr, optional

Interpolation method used when upsampling/resampling ephemeris data, ROSAT data. Options: ‘linear’, ‘index’, ‘values’, ‘pad’. See pandas.DataFrame.interpolate documentation for more information. Default is ‘linear’.

verbosebool, optional

If True, print messages. Default is True

lexi_databool, optional

If True, get the LEXI data for the same time range as the spacecraft parameters. Default is False.

return_data_typestr, optional

Type of data to return. This parameter is only used when lexi_data is True. This defines what kind of dataframes to return. Valid options are:

  • ‘merged’: Merged LEXI and spacecraft parameters dataframes using the ‘pd.merge_asof’ function with a tolerance of 1 minute and direction of ‘nearest’. Default option.

  • ‘lexi’: LEXI data only

  • ‘spc_prams’: Spacecraft parameters data only

  • ‘both’: Both LEXI and spacecraft parameters dataframes

  • ‘all’: All three dataframes

Default is ‘merged’

lexi_data_kwargsdict, optional

Keyword arguments to pass to the get_lexi_data function. Default is None. If None, then the default values of the get_lexi_data function are used.

Returns

dfpandas DataFrame

Spacecraft parameters data

df_lexipandas DataFrame

LEXI data

df_mergedpandas DataFrame

Merged LEXI and spacecraft parameters data

Example Usage

The following example shows how to use the get_spc_prams function to get spacecraft parameters data for a specific time range

>>> from lexi_xray.lexi import get_spc_prams
>>> df_spc = get_spc_prams(
        time_range=["2025-03-04 08:50:00", "2025-03-04 09:23:00"],
        verbose=True
    )

Jupyter Notebook Usage:

from lexi_xray.lexi import get_spc_prams

df_spc = get_spc_prams(
    time_range=["2025-03-04 08:50:00", "2025-03-04 09:23:00"],
    verbose=False
)

print(df_spc.head())
                                 RA       DEC
epoch_utc                                    
2025-03-04 08:50:00+00:00  4.014338 -0.397708
2025-03-04 08:50:01+00:00  4.014341 -0.397709
2025-03-04 08:50:02+00:00  4.014344 -0.397709
2025-03-04 08:50:03+00:00  4.014347 -0.397710
2025-03-04 08:50:04+00:00  4.014350 -0.397711