km3astro.plot

Plotting utilities.

Module Contents

Functions

ra_dec(skycoord)

Take (ra, dec) from skycoord in matplotlib-firendly format.

projection_axes([projection])

plot_equatorial(evts[, projection, ax, marker, ...])

get_coord_from_skycoord(SC, frame, detector)

Return the coordinate of a SkyCoord object for aitoff or mollweide projection

plot_SkyCoord(SC, frame, detector[, projection, ax, ...])

Plot given SkyCoord object or list

get_Sky_label(SC, frame, detector[, time])

Return the coordinate of a SkyCoord object as string to use as label for matplotlib.

get_label(plot_frame)

Return the Axis label corresponding to the plot frame.

get_horizon(detector, time, frame[, alt_cut])

Calculate the Horizon line of view for a given detector, time and frame system.

get_galactic_plan(detector, time, frame)

Calculate the Galactic plan for a given detector, time and frame system.

get_obstime(table_Sky[, it])

return the observation time for a table of SkyCoord at given index.

get_alert_color(alert_type)

Return the color for a specific alert_type

plot_pd_skycoord(table_skycoord, plot_frame, ...)

plot a pandas DataFrame of SkyCoord.

plot_file(file0, ax, projection, frame, detector, ...)

plot a csv file containing alerts.

calculate_visibility_map([detector, frame, alt_cut])

Calculate the visibility map of a detector in a frame for a given cut on altitude.

read_visibility_map(visi_map)

Read a given visibility map

get_visi_map_path(frame, detector)

Return the path to a visibility map for a given frame and detector

plot_visibility(ax[, frame, detector, plot_colorscale])

Plot on the background the visibility map corresponding to the frame and detector

skymap_hpx(file0[, save, path, name])

Method to plot a skymap from an hpx url

skymap_list([file0, dataframe, frame, detector, ...])

Method to plot a skymap from a list of alert in a csv file.

skymap_alert([file0, ra, dec, error_radius, obstime, ...])

Method to plot a skymap from an alert in a csv file or by giving RA, DEC and obstime.

km3astro.plot.ra_dec(skycoord)[source]

Take (ra, dec) from skycoord in matplotlib-firendly format.

This wraps the ra because astropy’s convention differs from matplotlib.

km3astro.plot.projection_axes(projection='aitoff', **figargs)[source]
km3astro.plot.plot_equatorial(evts, projection='aitoff', ax=None, marker='o', markersize=4, alpha=0.8, adjust_subplots=True, **kwargs)[source]
km3astro.plot.get_coord_from_skycoord(SC, frame, detector)[source]

Return the coordinate of a SkyCoord object for aitoff or mollweide projection

Parameters:
SCastropy.SkyCoord

The sky coordinate.

framestr

The frame of the coordinate, either “ParticleFrame” or “UTM” or “altaz” or “equatorial” or “galactic”

detectorstr [default = “antares”]

Detector of the coordinate, either “orca”, “arca” or “antares”.

Returns:
(phi, theta)/(az, ze)/(alt, az)/(ra, dec)/(l, b)(float, float)

The set of coordinate.

km3astro.plot.plot_SkyCoord(SC, frame, detector, projection='aitoff', ax=None, marker='s', markersize=3, alpha=0.8, adjust_subplots=True, **kwargs)[source]

Plot given SkyCoord object or list

km3astro.plot.get_Sky_label(SC, frame, detector, time=False)[source]

Return the coordinate of a SkyCoord object as string to use as label for matplotlib.

Parameters:
SCastropy.SkyCoord

The sky coordinate.

framestr

The frame of the coordinate, either “ParticleFrame” or “UTM” or “altaz” or “equatorial” or “galactic”

detectorstr [default = “antares”]

Detector of the coordinate, either “orca”, “arca” or “antares”.

timebool

Bool to integrate or no the time in the label.

Returns:
labelsstr

A string containing the coordinate and time if asked to use as label.

km3astro.plot.get_label(plot_frame)[source]

Return the Axis label corresponding to the plot frame.

Parameters:
plot_framestr

The plot frame.

Returns:
(xlab, ylab)(str,str)

X and Y axis name to use as label.

km3astro.plot.get_horizon(detector, time, frame, alt_cut=5.7)[source]

Calculate the Horizon line of view for a given detector, time and frame system.

Parameters:
detectorstr

Detector to use, either “orca”, “arca” or “antares”.

timestr or astropy.Time

The time of observation of the alert.

framestr

The frame to return the calculated horizon, either “ParticleFrame” or “UTM” or “equatorial” or “galactic”

cutfloat[default = 5.7]

Value in degree of the cut in Altitude for Altaz frame. By default at 5.7 degree corresponding to cos(0.1).

Returns:
horizonnp.ndarray(astropy.SkyCoord)

A list of SkyCoord representing the horizon line of view.

km3astro.plot.get_galactic_plan(detector, time, frame)[source]

Calculate the Galactic plan for a given detector, time and frame system.

Parameters:
detectorstr

Detector to use, either “orca”, “arca” or “antares”.

timestr or astropy.Time

The time of observation of the alert.

framestr

The frame to return the calculated horizon, either “ParticleFrame” or “UTM” or “equatorial” or “galactic”

Returns:
gal_plannp.ndarray(astropy.SkyCoord)

A list of SkyCoord representing the galactic plan.

km3astro.plot.get_obstime(table_Sky, it=0)[source]

return the observation time for a table of SkyCoord at given index.

km3astro.plot.get_alert_color(alert_type)[source]

Return the color for a specific alert_type Based on color list tab:Palette 10

km3astro.plot.plot_pd_skycoord(table_skycoord, plot_frame, detector_to, projection, ax)[source]

plot a pandas DataFrame of SkyCoord.

km3astro.plot.plot_file(file0, ax, projection, frame, detector, plot_frame, detector_to)[source]

plot a csv file containing alerts.

km3astro.plot.calculate_visibility_map(detector='orca', frame='equatorial', alt_cut=5.7)[source]
Calculate the visibility map of a detector in a frame for a given cut on altitude.

Warning: Time of Calcultation can be really long.

Parameters:
detectorstr [default=orca]

The detector to use for calculation, either “orca”, “arca” or “antares.

framestr [default=”equatorial”]

The frame to use for the visibility map, either “equatorial” or “galactic”

alt_cutfloat [default=5.7]

The cut in altitude of the detector line of view. default is 5.7 degree corresponding to cos(0.1)

Returns:
visi_mapcsv

Write a file containing the visibility map table. Already included visibility_map: antares, orca, arca in equatorial and galactic

km3astro.plot.read_visibility_map(visi_map)[source]

Read a given visibility map

km3astro.plot.get_visi_map_path(frame, detector)[source]

Return the path to a visibility map for a given frame and detector

km3astro.plot.plot_visibility(ax, frame='equatorial', detector='antares', plot_colorscale=False)[source]

Plot on the background the visibility map corresponding to the frame and detector

km3astro.plot.skymap_hpx(file0, save=False, path='', name='')[source]

Method to plot a skymap from an hpx url

Parameters:
file0str

The path to the healpix file.

savebool

To save or not the fig

pathstr

Path to the writing location.

namestr

Path and name of where to write the skymap png file.

Returns:
Figfile.png

A png file of the skymap.

km3astro.plot.skymap_list(file0='', dataframe=pd.DataFrame(), frame='equatorial', detector='antares', plot_frame='equatorial', detector_to='antares', title='', save=False, path='', name='')[source]

Method to plot a skymap from a list of alert in a csv file.

Parameters:
file0str

The path to the csv file containing the list of alert.

dataframe = pd.DataFrame()

The dataframe containing the list of alert

frame :str [default = “equatorial”]

The frame of alerts in file0

detectorstr [default = “antares”]

The detector of the alerts, either “orca”, “arca” or “antares”

plot_framestr [default = “equatorial”]

The frame of the skymap, either “equatorial” or “galactic”

detector_tostr [default = “antares”]

The detector to use for frame transformation, either “orca”, “arca” or “antares”

titlestr [default = “”]

Title of the figure

savebool [default = False]

To save or not the figure

pathstr

Path to the writing location

namestr

Name the skymap png file.

Returns:
Figfile.png

A png file of the skymap.

km3astro.plot.skymap_alert(file0='', ra=1000, dec=1000, error_radius=None, obstime='', frame='equatorial', detector='antares', plot_frame='equatorial', detector_to='antares', alt_cut=5.7, title='', save=False, path='', name='')[source]

Method to plot a skymap from an alert in a csv file or by giving RA, DEC and obstime.

Parameters:
file0str [default = “”]

The path to the csv file containing the alert.

ra, dec(float,float)

The ra and dec coordinate of the alert.

error_radiusfloat

The radius of the error circle around the alert coordinate.

obstimestr

The observation time of the alert. Format is “YYYY-MM-DDTHH:MM:SS”

frame :str [default = “equatorial”]

The frame of the alert.

detectorstr [default = “antares”]

The detector of the alert.

plot_framestr [default = “equatorial”]

The frame of the skymap, either “ParticleFrame”, “UTM”, “equatorial” or “galactic”

detector_to :str [default = “antares”]

The detector to use for frame transformation, either “orca”, “arca” or “antares”

alt_cutfloat [default = 5.7]

The altitude cut on detector visibility for horizon calculation. default is alt_cut = 5.7 degree which correspond to cos(0.1).

titlestr [default = “”]

Title of the figure

savebool [default = False]

To save or not the figure

pathstr

Path to the writing location.

namestr [default = “”]

Name of the skymap png file.

Returns:
Figfile.png

A png file of the skymap.