Make Lexi Images (lexi.make_lexi_images)

lexi_xray.lexi.make_lexi_images(time_range=None, time_zone='UTC', interp_method='linear', time_step=1, ra_range=[0, 360], dec_range=[-90, 90], ra_res=0.5, dec_res=0.5, time_integrate=None, background_correction_on=True, save_exposure_map_file=False, save_exposure_map_image=False, save_sky_backgrounds_file=False, save_sky_backgrounds_image=False, save_lexi_images=False, verbose=True, array_to_image_kwargs={})[source]

Function to generate LEXI images for a given time range and RA/DEC range and resolution using ROSAT data and exposure maps

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”

interp_methodstr, optional

Interpolation method used when upsampling/resampling ephemeris data, ROSAT data. Options:

‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’.

See pandas.DataFrame.interpolate documentation for more information. Default is ‘linear’.

time_stepint or float, optional

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

time_integrateint or float, optional

Integration time in seconds. If no integration time is provided, the time span of the time_range is used.

ra_rangelist, optional

Range of right ascension in degrees. If no range is provided, the range of the spacecraft ephemeris data is used.

dec_rangelist, optional

Range of declination in degrees. If no range is provided, the range of the spacecraft ephemeris data is used.

ra_resfloat, optional

Right ascension resolution in degrees. Default is 0.5 degrees.

dec_resfloat, optional

Declination resolution in degrees. Default is 0.5 degrees.

background_correction_onbool, optional

If True, apply the background correction to the LEXI images. Default is True.

save_exposure_map_filebool, optional

If True, save the exposure maps to a binary file. Default is False.

save_exposure_map_imagebool, optional

If True, save the exposure maps to a PNG image. Default is False.

save_sky_backgrounds_filebool, optional

If True, save the sky backgrounds to a binary file. Default is False.

save_sky_backgrounds_imagebool, optional

If True, save the sky backgrounds to a PNG image. Default is False.

save_lexi_imagesbool, optional

If True, save the LEXI images to a PNG file. Default is False.

verbosebool, optional

If True, print messages. Default is True

array_to_image_kwargsdict, optional

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

Returns

lexi_images_dictdict
Dictionary containing the following keys:
  • lexi_imagesnumpy array

    LEXI images

  • exposure_mapsnumpy array

    Exposure maps

  • sky_backgroundsnumpy array

    Sky backgrounds (if background_correction_on is True)

  • ra_arrnumpy array

    Right ascension array

  • dec_arrnumpy array

    Declination array

  • time_rangelist

    Time range of the LEXI images

  • time_integrateint or float

    Integration time in seconds of the LEXI images

  • ra_rangelist

    Right ascension range of the LEXI images in degrees

  • dec_rangelist

    Declination range of the LEXI images in degrees

  • ra_resfloat

    Right ascension resolution of the LEXI images in degrees

  • dec_resfloat

    Declination resolution of the LEXI images in degrees

Example Usage

The following example shows how to get LEXI images for a given time range and RA/DEC range and resolution

>>> from lexi_xray.lexi import make_lexi_images
>>> lexi_images_dict = make_lexi_images(
        time_range=["2025-03-04 08:50:00", "2025-03-04 09:23:00"],
        ra_range=[190, 310],
        dec_range=[-33, 3],
        ra_res=0.5,
        dec_res=0.5,
        # time_integrate=500,
        background_correction_on=True,
        save_exposure_map_file=True,
        save_sky_backgrounds_file=True,
        save_exposure_map_image=True,
        save_sky_backgrounds_image=True,
        save_lexi_images=True,
        verbose=True
    )

Jupyter Notebook Usage:

from lexi_xray.lexi import make_lexi_images

lexi_images_dict = make_lexi_images(
    time_range=["2025-03-04 08:50:00", "2025-03-04 09:23:00"],
    ra_range=[220, 240],
    dec_range=[-30, -15],
    ra_res=1,
    dec_res=1,
    background_correction_on=False,
    save_exposure_map_file=False,
    save_sky_backgrounds_file=False,
    save_exposure_map_image=False,
    save_sky_backgrounds_image=False,
    save_lexi_images=True,
    verbose=False,
    array_to_image_kwargs={"display": True}
)

print(lexi_images_dict.keys())
Downloading files from data/level_1c/cdf/1.0.0 on branch stable:
A total of 1917 files found

Files to download: 9

Exposure map not found, computing now. This may take a while 

../../_images/index_0_12.png
dict_keys(['lexi_images', 'exposure_maps', 'ra_arr', 'dec_arr', 'time_range', 'time_integrate', 'ra_range', 'dec_range', 'ra_res', 'dec_res', 'start_time_arr', 'stop_time_arr'])