Title: | Spherical Projections of Astronomical Data |
---|---|
Description: | Provides easy to use functions to create all-sky grid plots of widely used astronomical coordinate systems (equatorial, ecliptic, galactic) and scatter plots of data on any of these systems including on-the-fly system conversion. It supports any type of spherical projection to the plane defined by the 'mapproj' package. |
Authors: | Alberto Krone-Martins |
Maintainer: | Alberto Krone-Martins <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0 |
Built: | 2025-02-14 05:26:24 UTC |
Source: | https://github.com/cran/SPADAR |
Provides easy to use functions to create all-sky grid plots of widely used astronomical coordinate systems (equatorial, ecliptic, galactic) and scatter plots of data on any of these systems including on-the-fly coordinate system conversion. It supports any type of spherical projection defined by the mapproj package.
Package: | SPADAR |
Type: | Package |
Version: | 1.0 |
Date: | 2017-04-29 |
License: | GPL (>= 3) |
The SPADAR package provides simple functions to create spherical projection plots of astronomical data. It enables the creation of coordinate system grids (as backgrounds or overlays) in equatorial, ecliptic and galactic coordinates and also supports the conversion between these coordinate systems (J2000). The plots can adopt multiple spherical projections to the plane (aitoff, mollweide, mercator using the default projection parameters are tested). Coordinate system conversions are performed by a modified version of the euler function from the astrolibR package, and plane projections by the mapproj package.
This package comes with a small dataset containing Ultra High Energy Cosmic Ray events (from the Pierre Auger Observatory 2014 event list), for example and test purposes.
Alberto Krone-Martins
Maintainer: Alberto Krone-Martins <[email protected]>
createAllSkyScatterPlotChart
,
createAllSkyGridChart
,
overplotScatterPlotInAllSkyGridChart
# Creates an all sky chart with Equatorial, Ecliptic and Galactic coordinate systems # superposed. Equatorial as the main system in black, the Ecliptic in blue and the # Galactic in red createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=TRUE, galDraq=TRUE, eqCol="black", eclCol=rgb(0,0,1,0.5), galCol=rgb(1,0,0,0.5), eqLty=1, eclLty=2, galLty=2) # Creates an all sky scatter plot of the Pierre Auger Observatory 2014 public event list # (arXiv:1411.6111). Equatorial and Galactic coordinate systems superposed; # Galactic as the main system in black and the Equatorial in red. data(uhecrauger2014) createAllSkyScatterPlotChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev), eqDraw=TRUE, eclDraw=FALSE, galDraq=TRUE, galCol="black", eqLty=2, galLty=1, eqCol=rgb(1,0,0,0.5)) # Creates a grid with the Galactic Coordinate system and overplots data createAllSkyGridChart(mainGrid="galactic", eqDraw=FALSE, eclDraw=FALSE, galDraq=TRUE, galCol=rgb(0,0,0,0.5), galLty=1) overplotScatterPlotInAllSkyGridChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev))
# Creates an all sky chart with Equatorial, Ecliptic and Galactic coordinate systems # superposed. Equatorial as the main system in black, the Ecliptic in blue and the # Galactic in red createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=TRUE, galDraq=TRUE, eqCol="black", eclCol=rgb(0,0,1,0.5), galCol=rgb(1,0,0,0.5), eqLty=1, eclLty=2, galLty=2) # Creates an all sky scatter plot of the Pierre Auger Observatory 2014 public event list # (arXiv:1411.6111). Equatorial and Galactic coordinate systems superposed; # Galactic as the main system in black and the Equatorial in red. data(uhecrauger2014) createAllSkyScatterPlotChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev), eqDraw=TRUE, eclDraw=FALSE, galDraq=TRUE, galCol="black", eqLty=2, galLty=1, eqCol=rgb(1,0,0,0.5)) # Creates a grid with the Galactic Coordinate system and overplots data createAllSkyGridChart(mainGrid="galactic", eqDraw=FALSE, eclDraw=FALSE, galDraq=TRUE, galCol=rgb(0,0,0,0.5), galLty=1) overplotScatterPlotInAllSkyGridChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev))
A function to create all-sky charts with gridlines of one or more astronomical coordinate systems.
The function can create gridlines for the equatorial, ecliptic or galactic coordinate systems. Any spherical projection supported by the mapproj package is supported (but only the Aitoff, Mollweide and Mercator projections routinely are tested).
createAllSkyGridChart(longitude = c(0, 45, 90, 135, 180, 225, 270, 315, 360), latitude = c(-75, -60, -45, -30, -15, 0, 15, 30, 45, 60, 75), mainGrid = "equatorial", eqCol = "red", eclCol = "blue", galCol = "green", eqLty = 1, eclLty = 2, galLty = 3, eqLwd = 1, eclLwd = 1, galLwd = 1, eqDraw = TRUE, eclDraw = TRUE, galDraq = TRUE, projname = "aitoff", projparam = NULL, projorient = NULL, npoints = 50, overplot = FALSE, addLab = TRUE, label.cex = 0.6, main = paste("All-Sky Grid (", projname, ")", sep = ""), ...)
createAllSkyGridChart(longitude = c(0, 45, 90, 135, 180, 225, 270, 315, 360), latitude = c(-75, -60, -45, -30, -15, 0, 15, 30, 45, 60, 75), mainGrid = "equatorial", eqCol = "red", eclCol = "blue", galCol = "green", eqLty = 1, eclLty = 2, galLty = 3, eqLwd = 1, eclLwd = 1, galLwd = 1, eqDraw = TRUE, eclDraw = TRUE, galDraq = TRUE, projname = "aitoff", projparam = NULL, projorient = NULL, npoints = 50, overplot = FALSE, addLab = TRUE, label.cex = 0.6, main = paste("All-Sky Grid (", projname, ")", sep = ""), ...)
longitude |
A vector with the positions of the first coordinate lines in degrees (Right Ascention, for data in the Equatorial system, Ecliptic Longitude for the Ecliptic system or Galactic Longitude for the Galactic System). |
latitude |
A vector with the positions of the second coordinate lines in degrees (Declination, for data in the Equatorial system, Ecliptic Latitude for the Ecliptic system or Galactic Latitude for the Galactic System). |
mainGrid |
String. The main coordinate system of the plot. It can take the following values: "equatorial", "ecliptic" or "galactic". It defaults to "equatorial". |
eqCol |
String. The color of the Equatorial coordinate system lines. |
eclCol |
String. The color of the Ecliptic coordinate system lines. |
galCol |
String. The color of the Galactic coordinate system lines. |
eqLty |
Numeric. The line type of the Equatorial coordinate system lines. |
eclLty |
Numeric. The line type of the Ecliptic coordinate system lines. |
galLty |
Numeric. The line type of the Galactic coordinate system lines. |
eqLwd |
Numeric. The line width of the Equatorial coordinate system lines. |
eclLwd |
Numeric. The line width of the Ecliptic coordinate system lines. |
galLwd |
Numeric. The line width of the Galactic coordinate system lines. |
eqDraw |
Logical. A boolean to indicate if the Equatorial coordinate system lines should be draw. |
eclDraw |
Logical. A boolean to indicate if the Ecliptic coordinate system lines should be draw. |
galDraq |
Logical. A boolean to indicate if the Galactic coordinate system lines should be draw. |
projname |
String. The spherical projection of the plot. It can take as argument any projection supported by the mapproj package, but only "aitoff", "mollweide" and "mercator" are tested automatically. It defaults to "aitoff". |
projparam |
Parameters to configure the projection. It defaults to NULL. |
projorient |
The orientation of the projection. It defaults to NULL. |
npoints |
Numeric. The number of points used to draw each grid line. Defaults to 50. |
overplot |
Logical. A boolean to indicate if the grid should be overploted or a new plot should be created. |
addLab |
Logical. A boolean to indicate if the labels should be added. |
label.cex |
Numeric. The size of the labels. |
main |
String. The main title of the plot. |
... |
Additional parameters to be passed to |
Alberto Krone-Martins
createAllSkyScatterPlotChart
,
overplotScatterPlotInAllSkyGridChart
,
lines
,
mapproject
.
# Creates an all sky chart with Equatorial, Ecliptic and Galactic coordinate systems superposed, # with the Equatorial as the main system in black, the Ecliptic in blue with 0.5 transparency and # dashed lines and the Galactic in red with 0.5 transparency and dashed lines createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=TRUE, galDraq=TRUE, eqCol="black", eclCol=rgb(0,0,1,0.5), galCol=rgb(1,0,0,0.5), eqLty=1, eclLty=2, galLty=2) # Equatorial and Galactic coordinate systems represented in a polyconic projection createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=FALSE, galDraq=TRUE, eqCol="black", galCol=rgb(1,0,0,0.5), eqLty=1, galLty=2, projname="polyconic") # The same as above, but in non-standard Aitoff projection with the South Pole # in the center og the projection createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=TRUE, galDraq=TRUE, eqCol="black", eclCol=rgb(0,0,1,0.5), galCol=rgb(1,0,0,0.5), eqLty=1, eclLty=2, galLty=2, projname="aitoff", projorient=c(0,0,0))
# Creates an all sky chart with Equatorial, Ecliptic and Galactic coordinate systems superposed, # with the Equatorial as the main system in black, the Ecliptic in blue with 0.5 transparency and # dashed lines and the Galactic in red with 0.5 transparency and dashed lines createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=TRUE, galDraq=TRUE, eqCol="black", eclCol=rgb(0,0,1,0.5), galCol=rgb(1,0,0,0.5), eqLty=1, eclLty=2, galLty=2) # Equatorial and Galactic coordinate systems represented in a polyconic projection createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=FALSE, galDraq=TRUE, eqCol="black", galCol=rgb(1,0,0,0.5), eqLty=1, galLty=2, projname="polyconic") # The same as above, but in non-standard Aitoff projection with the South Pole # in the center og the projection createAllSkyGridChart(mainGrid="equatorial", eqDraw=TRUE, eclDraw=TRUE, galDraq=TRUE, eqCol="black", eclCol=rgb(0,0,1,0.5), galCol=rgb(1,0,0,0.5), eqLty=1, eclLty=2, galLty=2, projname="aitoff", projorient=c(0,0,0))
A function to create all-sky scatter plots with superposed gridlines of one or more astronomical coordinate systems.
The function will perform the convertion of the coordinate system to place the data and the grid on the same system. Please, note that you must specify which coordinate system the data is, as well as which is the coordinate system you want the plot to be. The function can create gridlines for the equatorial, ecliptic or galactic coordinate systems. Any spherical projection supported by the mapproj package is supported (but only the Aitoff, Mollweide and Mercator projections are routinely tested).
createAllSkyScatterPlotChart(x, y, pointcol = rgb(0, 0, 0, 0.5), pointsize = 0.5, dataCoordSys = "equatorial", mainGrid = "equatorial", eqCol = "red", eclCol = "blue", galCol = "green", eqLty = 1, eclLty = 2, galLty = 3, eqLwd = 1, eclLwd = 1, galLwd = 1, eqDraw = TRUE, eclDraw = TRUE, galDraq = TRUE, projname = "aitoff", projparam = NULL, projorient = NULL, nGridpoints = 100, addLab=TRUE, label.cex=0.6, main = paste("All-Sky Scatter Plot (", projname, ")", sep = ""), ...)
createAllSkyScatterPlotChart(x, y, pointcol = rgb(0, 0, 0, 0.5), pointsize = 0.5, dataCoordSys = "equatorial", mainGrid = "equatorial", eqCol = "red", eclCol = "blue", galCol = "green", eqLty = 1, eclLty = 2, galLty = 3, eqLwd = 1, eclLwd = 1, galLwd = 1, eqDraw = TRUE, eclDraw = TRUE, galDraq = TRUE, projname = "aitoff", projparam = NULL, projorient = NULL, nGridpoints = 100, addLab=TRUE, label.cex=0.6, main = paste("All-Sky Scatter Plot (", projname, ")", sep = ""), ...)
x |
A vector with the data in degrees for the first coordinate (Right Ascention, for data in the Equatorial system, Ecliptic Longitude for the Ecliptic system or Galactic Longitude for the Galactic System). |
y |
A vector with the data in degrees for the second coordinate (Declination, for data in the Equatorial system, Ecliptic Latitude for the Ecliptic system or Galactic Latitude for the Galactic System). |
pointcol |
A scalar or a vector with, the same size of the x and y vectors, containing the color of the points. |
pointsize |
A scalar or a vector with, the same size of the x and y vectors, containing the sizes of the points. |
dataCoordSys |
String. The name of the coordinate system of the x and y vector. It can take the following values: "equatorial", "ecliptic" or "galactic". It defaults to "equatorial". |
mainGrid |
String. The name of the the main coordinate system of the plot. It can take the following values: "equatorial", "ecliptic" or "galactic". It defaults to "equatorial". |
eqCol |
String. The color of the Equatorial coordinate system lines. |
eclCol |
String. The color of the Ecliptic coordinate system lines. |
galCol |
String. The color of the Galactic coordinate system lines. |
eqLty |
Numeric. The line type of the Equatorial coordinate system lines. |
eclLty |
Numeric. The line type of the Ecliptic coordinate system lines. |
galLty |
Numeric. The line type of the Galactic coordinate system lines. |
eqLwd |
Numeric. The line width of the Equatorial coordinate system lines. |
eclLwd |
Numeric. The line width of the Ecliptic coordinate system lines. |
galLwd |
Numeric. The line width of the Galactic coordinate system lines. |
eqDraw |
Logical. A boolean to indicate if the Equatorial coordinate system lines should be draw. |
eclDraw |
Logical. A boolean to indicate if the Ecliptic coordinate system lines should be draw. |
galDraq |
Logical. A boolean to indicate if the Galactic coordinate system lines should be draw. |
projname |
String. The spherical projection of the plot. It can take as argument any projection supported by the mapproj package, but only "aitoff", "mollweide" and "mercator" are tested automatically. It defaults to "aitoff". |
projparam |
Parameters to configure the projection. It defaults to NULL. |
projorient |
The orientation of the projection. It defaults to NULL. |
nGridpoints |
Numeric. The number of points used to draw each grid line. Defaults to 50. |
addLab |
Logical. A boolean to indicate if the labels should be added. |
label.cex |
Numeric. The size of the labels. |
main |
String. The main title of the plot. |
... |
Additional parameters to be passed to |
Alberto Krone-Martins
createAllSkyGridChart
,
overplotScatterPlotInAllSkyGridChart
,
points
,
mapproject
.
# Creates an all sky scatter plot of the Pierre Auger Observatory 2014 public event list # (arXiv:1411.6111), with Equatorial and Galactic coordinate systems superposed, and using # the Galactic as the main system in black and the Equatorial in red with 0.5 transparency # and dashed lines. The point sizes encode the energy of the cosmic ray. data(uhecrauger2014) createAllSkyScatterPlotChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev), eqDraw=TRUE, eclDraw=FALSE, galDraq=TRUE, galCol="black", eqLty=2, galLty=1, eqCol=rgb(1,0,0,0.5))
# Creates an all sky scatter plot of the Pierre Auger Observatory 2014 public event list # (arXiv:1411.6111), with Equatorial and Galactic coordinate systems superposed, and using # the Galactic as the main system in black and the Equatorial in red with 0.5 transparency # and dashed lines. The point sizes encode the energy of the cosmic ray. data(uhecrauger2014) createAllSkyScatterPlotChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev), eqDraw=TRUE, eclDraw=FALSE, galDraq=TRUE, galCol="black", eqLty=2, galLty=1, eqCol=rgb(1,0,0,0.5))
A function to overplot points represented some astronomical coordinate system on top of all-sky charts in any coordinate system and projection. The function will perform the convertion of the data coordinate system to match the chart coordinate system, but this must be specified by the user. Any spherical projection supported by the mapproj package is supported (but only the Aitoff, Mollweide and Mercator projections are routinely tested).
overplotScatterPlotInAllSkyGridChart(x, y, pointcol = rgb(0, 0, 0, 0.5), pointsize = 0.5, dataCoordSys = "equatorial", mainGrid = "equatorial", projname = "aitoff", projparam = NULL, projorient = NULL, ...)
overplotScatterPlotInAllSkyGridChart(x, y, pointcol = rgb(0, 0, 0, 0.5), pointsize = 0.5, dataCoordSys = "equatorial", mainGrid = "equatorial", projname = "aitoff", projparam = NULL, projorient = NULL, ...)
x |
A vector with the data in degrees for the first coordinate (Right Ascention, for data in the Equatorial system, Ecliptic Longitude for the Ecliptic system or Galactic Longitude for the Galactic System). |
y |
A vector with the data in degrees for the second coordinate (Declination, for data in the Equatorial system, Ecliptic Latitude for the Ecliptic system or Galactic Latitude for the Galactic System). |
pointcol |
A scalar or a vector with, the same size of the x and y vectors, containing the color of the points. |
pointsize |
A scalar or a vector with, the same size of the x and y vectors, containing the sizes of the points. |
dataCoordSys |
String. The name of the coordinate system of the x and y vector. It can take the following values: "equatorial", "ecliptic" or "galactic". It defaults to "equatorial". |
mainGrid |
String. The name of the the main coordinate system of the plot. It can take the following values: "equatorial", "ecliptic" or "galactic". It defaults to "equatorial". |
projname |
A string with the spherical projection of the plot. It can take as argument any projection supported by the mapproj package, but only "aitoff", "mollweide" and "mercator" are tested automatically. It defaults to "aitoff". |
projparam |
Parameters to configure the projection. It defaults to "NULL", as they are not needed for "aitoff". |
projorient |
The orientation of the projection. |
... |
Additional parameters to be passed to |
Alberto Krone-Martins
createAllSkyScatterPlotChart
,
createAllSkyGridChart
# Creates a grid with the Galactic Coordinate system. createAllSkyGridChart(mainGrid="galactic", eqDraw=FALSE, eclDraw=FALSE, galDraq=TRUE, galCol=rgb(0,0,0,0.5), galLty=1) # Overplots the Pierre Auger Observatory 2014 public event list (arXiv:1411.6111). data(uhecrauger2014) overplotScatterPlotInAllSkyGridChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev))
# Creates a grid with the Galactic Coordinate system. createAllSkyGridChart(mainGrid="galactic", eqDraw=FALSE, eclDraw=FALSE, galDraq=TRUE, galCol=rgb(0,0,0,0.5), galLty=1) # Overplots the Pierre Auger Observatory 2014 public event list (arXiv:1411.6111). data(uhecrauger2014) overplotScatterPlotInAllSkyGridChart(uhecrauger2014$RA, uhecrauger2014$DEC, mainGrid="galactic", dataCoordSys="equatorial", pointcol="black", pch=19, pointsize=uhecrauger2014$Eev/max(uhecrauger2014$Eev))
This data set gives Equatorial coordinates and energy of the highest energy events observed by the Pierre Auger Observatory up to 2014.
uhecrauger2014
uhecrauger2014
A data frame with three columns. The first column contains the right ascension of the arrival diretion, the second the declination and the third the cosmic ray energy.
Pierre Auger Observatory 2014 event list
A. Aab et al. (The Pierre Auger Collaboration), 2014, "Searches for Anisotropies in the Arrival Directions of the Highest Energy Cosmic Rays Detected by the Pierre Auger Observatory", arXiv:1411.6111.