km3astro.toolbox

Module Contents

Functions

get_az_zenith(SC[, detector, unit])

Get the azimuth and zenith for a given sky coordinate

get_phi_theta(SC[, detector, unit])

Get the phi and theta for a given sky coordinate

get_alt_az(SC[, unit])

Get the altitude and azimuth for a given sky coordinate

get_ra_dec(SC[, unit])

Get the right ascension and declination for a given sky coordinate

get_l_b(SC[, unit])

Get the galactic longitude and galactic latiture for a given sky coordinate

global_transform(frame_from, frame_to, *args)

Global frame transformation function

eq_to_utm(ra, dec, date, time, det)

Equatorial to UTM frame transformation function

eq_to_loc(ra, dec, date, time, det)

Equatorial to ParticleFrame frame transformation function

eq_to_gal(ra, dec, date, time)

Equatorial to galactic frame transformation function

loc_to_eq(phi, theta, date, time, det)

ParticleFrame to equatorial frame transformation function

loc_to_utm(phi, theta, date, time, det)

ParticleFrame to UTM frame transformation function

loc_to_gal(phi, theta, date, time, det)

ParticleFrame to galactic frame transformation function

print_eq_to_utm(ra, dec, date, time, det)

Equatorial to UTM frame print function

print_eq_to_loc(ra, dec, date, time, det)

Equatorial to ParticleFrame frame print function

print_eq_to_gal(ra, dec, date, time)

Equatorial to galactic frame print function

print_loc_to_eq(phi, theta, date, time, det)

ParticleFrame to equatorial frame print function

print_loc_to_utm(phi, theta, date, time, det)

ParticleFrame to UTM frame print function

print_loc_to_gal(phi, theta, date, time, det)

ParticleFrame to galactic frame print function

print_Skycoord(SkyCoord)

Print Skycoord object

reader_from_file(file)

read a csv file into a pandas DataFrame

get_frame_name(SC)

Get the frame name from a SkyCoord object

get_obstime(SC)

Get the time of observation from a SkyCoord object

split_date_time(dt)

Split in date and time a string from the observation time of a SkyCoord object

Skycoord_breaker(data_SC)

Break a pandas DataFrame of SkyCoord into a new DataFrame with every parameters (date, time, ra/l/phi/az, dec/b/theta/alt)

transform_file(file0, frame_from, frame_to[, ...])

Transform the input file containing coordinate into a new table of those coordinate in a new frame

build_skycoord_list(table, frame[, detector])

Transform the input table containing coordinate into a new table of SkyCoord coordinate

km3astro.toolbox.get_az_zenith(SC, detector='antares', unit='deg')[source]

Get the azimuth and zenith for a given sky coordinate

Parameters:
SCastropy.SkyCoordinate

The sky coordinate.

detectorstr [default: “antares”]
The name of the detector, either “antares”, “orca” or “arca”
unitstr
The unit to be used on the output values, either “deg” or “rad”
Returns:
(azimuth, zenith): (float, float)
Azimuth and zenith in the requested unit
km3astro.toolbox.get_phi_theta(SC, detector='antares', unit='deg')[source]

Get the phi and theta for a given sky coordinate

Parameters:
SCastropy.SkyCoordinate

The sky coordinate.

detectorstr [default: “antares”]
The name of the detector, either “antares”, “orca” or “arca”
unitstr
The unit to be used on the output values, either “deg” or “rad”
Returns:
(phi, theta): (float, float)
phi and theta in the requested unit
km3astro.toolbox.get_alt_az(SC, unit='deg')[source]

Get the altitude and azimuth for a given sky coordinate

Parameters:
SCastropy.SkyCoordinate

The sky coordinate.

unitstr

The unit to be used on the output values, either “deg” or “rad”

Returns:
(altitude, azimuth): (float, float)
altitude and azimuth in the requested unit
km3astro.toolbox.get_ra_dec(SC, unit='deg')[source]

Get the right ascension and declination for a given sky coordinate

Parameters:
SCastropy.SkyCoordinate

The sky coordinate.

unitstr
The unit to be used on the output values, either “deg” or “rad” or “hourangle”
Returns:
(ra, dec): (float, float)
Ra and dec in the requested unit
km3astro.toolbox.get_l_b(SC, unit='deg')[source]

Get the galactic longitude and galactic latiture for a given sky coordinate

Parameters:
SCastropy.SkyCoordinate

The sky coordinate.

unitstr
The unit to be used on the output values, either “deg” or “rad”
Returns:
(l, b): (float, float)
l and b in the requested unit
km3astro.toolbox.global_transform(frame_from, frame_to, *args)[source]

Global frame transformation function

Parameters:
frame_fromstr

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

frame_tostr

The desired frame of the output sky coordinate

*argslist of the coordinate Parameters

The sky coordinate parameters. Varies with frame_from and follow “km3astro.coord.build_event” function for reference.

Returns:
sky_object: astropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.eq_to_utm(ra, dec, date, time, det)[source]

Equatorial to UTM frame transformation function

Parameters:
rafloat

Right ascension in degree of the sky object

decfloat

Declination in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector for the UTM coordinate system, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.eq_to_loc(ra, dec, date, time, det)[source]

Equatorial to ParticleFrame frame transformation function

Parameters:
rafloat

Right ascension in degree of the sky object

decfloat

Declination in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector for the ParticleFrame coordinate system, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.eq_to_gal(ra, dec, date, time)[source]

Equatorial to galactic frame transformation function

Parameters:
rafloat

Right ascension in degree of the sky object

decfloat

Declination in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.loc_to_eq(phi, theta, date, time, det)[source]

ParticleFrame to equatorial frame transformation function

Parameters:
phifloat

Phi in degree of the sky object

thetafloat

Theta in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector of the sky object, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.loc_to_utm(phi, theta, date, time, det)[source]

ParticleFrame to UTM frame transformation function

Parameters:
phifloat

Phi in degree of the sky object

thetafloat

Theta in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector of the sky object, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.loc_to_gal(phi, theta, date, time, det)[source]

ParticleFrame to galactic frame transformation function

Parameters:
phifloat

Phi in degree of the sky object

thetafloat

Theta in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector of the sky object, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_eq_to_utm(ra, dec, date, time, det)[source]

Equatorial to UTM frame print function

Parameters:
rafloat

Right ascension in degree of the sky object

decfloat

Declination in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector for the UTM coordinate system, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_eq_to_loc(ra, dec, date, time, det)[source]

Equatorial to ParticleFrame frame print function

Parameters:
rafloat

Right ascension in degree of the sky object

decfloat

Declination in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector for the ParticleFrame coordinate system, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_eq_to_gal(ra, dec, date, time)[source]

Equatorial to galactic frame print function

Parameters:
rafloat

Right ascension in degree of the sky object

decfloat

Declination in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_loc_to_eq(phi, theta, date, time, det)[source]

ParticleFrame to equatorial frame print function

Parameters:
phifloat

Phi in degree of the sky object

thetafloat

Theta in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector of the sky object, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_loc_to_utm(phi, theta, date, time, det)[source]

ParticleFrame to UTM frame print function

Parameters:
phifloat

Phi in degree of the sky object

thetafloat

Theta in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector of the sky object, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_loc_to_gal(phi, theta, date, time, det)[source]

ParticleFrame to galactic frame print function

Parameters:
phifloat

Phi in degree of the sky object

thetafloat

Theta in degree of the sky object

datestr

Date of the sky object, format “YYYY-MM-DD”

timestr

Time of the sky object, format “HH:MM:SS”

detstr
The name of the detector of the sky object, either “antares”, “orca” or “arca”
Returns:
SCastropy.SkyCoordinate

The sky coordinate.

km3astro.toolbox.print_Skycoord(SkyCoord)[source]

Print Skycoord object

km3astro.toolbox.reader_from_file(file)[source]

read a csv file into a pandas DataFrame

km3astro.toolbox.get_frame_name(SC)[source]

Get the frame name from a SkyCoord object

km3astro.toolbox.get_obstime(SC)[source]

Get the time of observation from a SkyCoord object

km3astro.toolbox.split_date_time(dt)[source]

Split in date and time a string from the observation time of a SkyCoord object

Parameters:
dtstr

the date and time string from a SkyCoord object observation time, format “YYYY-MM-DDTHH:MM:SS”

Returns:
(date, time): (str, str)

date and time of the sky object

km3astro.toolbox.Skycoord_breaker(data_SC)[source]

Break a pandas DataFrame of SkyCoord into a new DataFrame with every parameters (date, time, ra/l/phi/az, dec/b/theta/alt)

Parameters:
data_SCpandas.DataFrame(SkyCoord)

pandas DataFrame containing Skycoord object

Returns:
datapandas.DataFrame

A pandas DataFrame with every parameters of the input SkyCoord object

km3astro.toolbox.transform_file(file0, frame_from, frame_to, detector_from='orca', detector_to='orca', name='', return_data=False)[source]

Transform the input file containing coordinate into a new table of those coordinate in a new frame

Parameters:
file0str

The path to the csv file containing the coordinate. Should follow the “km3py/test-data/astro/benchmark” format.

frame_fromstr

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

frame_tostr

The desired frame of the output sky coordinate

detector_fromstr [default = “orca”]

Detector of the file0 coordinate, either “orca”, “arca” or “antares” . Mandatory if using frame_from = “ParticleFrame” or “UTM”.

detector_tostr [default = “orca”]

Detector to use for the coordinate transformation, either “orca”, “arca” or “antares” . Mandatory if using frame_to = “ParticleFrame” or “UTM”.

namestr [default = tempfile]

path and name of the output file.

Returns:
datacsv file

Csv file containing the pandas dataframe with the transformed coordinate.

km3astro.toolbox.build_skycoord_list(table, frame, detector='antares')[source]

Transform the input table containing coordinate into a new table of SkyCoord coordinate

Parameters:
tablepandas.DataFrame

The table from the csv file containing the sky parameter.

framestr

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

detectorstr [default = “antares”]

Detector of the coordinate inside the table, either “orca”, “arca” or “antares” . Mandatory if using frame_from = “ParticleFrame” or “UTM”.

Returns:
list_evtpandas.DataFrame(astropy.SkyCoord)

DataFrame containing astropy.SkyCoord object corresponding to the sky coordinate in the input table.