| Title: | Creates Interface with NASA 'Exoplanets Archive API' |
|---|---|
| Description: | Provides a user-friendly interface to NASA 'Exoplanets Archive API' <https://exoplanetarchive.ipac.caltech.edu/>, enabling retrieval and analysis of exoplanetary and stellar data. Includes functions for querying, filtering, summarizing, and computing derived parameters from the 'Exoplanets' catalog. |
| Authors: | Jakub Kołomański [cre, aut], Mateusz Kołomański [aut] |
| Maintainer: | Jakub Kołomański <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-05-13 07:54:36 UTC |
| Source: | https://github.com/jkolomanski/rexoplanets |
Function responsible for initializing and running the REXoplanets shiny application.
app(..., run = TRUE)app(..., run = TRUE)
... |
Additional arguments passed to |
run |
If true, runs the application. If false, returns an app object. |
App object.
Calculate the Earth Similarity Index (ESI)
calculate_esi(..., radius_w = 0.57, flux_w = 0.7)calculate_esi(..., radius_w = 0.57, flux_w = 0.7)
... |
Any number of numeric parameters representing the planet's characteristics.
Parameter names should have corresponding weight names ending in |
radius_w |
Numeric. Weight for radius. Default is 0.57. |
flux_w |
Numeric. Weight for stellar flux. Default is 0.7. |
The function calculates the ESI for any parameter or number of parameters. By default, it uses the weights of 0.57 for radius and 0.7 for stellar flux.
ESI (Earth Similarity Index) is a characterization of how similar a planetary-mass object or natural satellite is to Earth. It is designed to be a scale from zero to one, with Earth having a value of 1.
Numeric. Earth Similarity Index (ESI).
Schulze-Makuch, D., Méndez, A., Fairén, A. G., von Paris, P., Turse, C., Boyer, G., Davila, A. F., Resendes de Sousa António, M., Irwin, L. N., and Catling, D. (2011) A Two-Tiered Approach to Assess the Habitability of Exoplanets. Astrobiology 11(10): 1041-1052.
# ESI for radius and flux, returns 1 (Earth is perfectly similar to itself) calculate_esi(radius = 1, flux = 1) # Mars approximation using radius = 0.532 and flux = 0.43, returns approximately 0.754 calculate_esi(radius = 0.532, flux = 0.43) # Custom 3-parameter ESI (e.g. radius, flux, temperature) calculate_esi(radius = 1.1, flux = 1.2, temp = 288, radius_w = 0.5, flux_w = 0.3, temp_w = 0.2)# ESI for radius and flux, returns 1 (Earth is perfectly similar to itself) calculate_esi(radius = 1, flux = 1) # Mars approximation using radius = 0.532 and flux = 0.43, returns approximately 0.754 calculate_esi(radius = 0.532, flux = 0.43) # Custom 3-parameter ESI (e.g. radius, flux, temperature) calculate_esi(radius = 1.1, flux = 1.2, temp = 288, radius_w = 0.5, flux_w = 0.3, temp_w = 0.2)
Calculates star's habitable zone inner and outer radius, based on star's luminosity.
calculate_star_habitable_zone(st_lum, log_lum = TRUE)calculate_star_habitable_zone(st_lum, log_lum = TRUE)
st_lum |
A numeric Stellar luminosity value (log10(L/Lsun) or linear). |
log_lum |
A logical value. If |
A numeric vector of 2 elements where first is habitable zone inner radius and second is the outer radius.
calculate_star_habitable_zone(0) # habitable zone for sun, with logarithmic units calculate_star_habitable_zone(1, log_lum = FALSE) # habitable zone for sun, with linear unitscalculate_star_habitable_zone(0) # habitable zone for sun, with logarithmic units calculate_star_habitable_zone(1, log_lum = FALSE) # habitable zone for sun, with linear units
Calculate stellar flux value
calculate_stellar_flux(st_lum, pl_orbsmax, log_lum = TRUE, unit = "relative")calculate_stellar_flux(st_lum, pl_orbsmax, log_lum = TRUE, unit = "relative")
st_lum |
Numeric. Stellar luminosity (log10(L/Lsun) or linear). |
pl_orbsmax |
Numeric. Orbital distance in AU. |
log_lum |
Logical. If TRUE, assumes |
unit |
Character. Either |
This function calculates the stellar flux based on provided values. It assumes luminosity is either logarithmic (log10 of L/Lsun) or linear, and optionally converts flux to absolute units (W/m²) if requested.
Stellar flux is the amount of energy from a star that reaches a given area per unit time.
Numeric. Stellar flux (relative or in W/m²).
# Solar-type star, Earth-like orbit calculate_stellar_flux(st_lum = 0, pl_orbsmax = 1) # Linear luminosity input (not log), 5x Sun at 2 AU calculate_stellar_flux(st_lum = 5, pl_orbsmax = 2, log_lum = FALSE) # Output in absolute units (W/m²), Earth-like conditions calculate_stellar_flux(st_lum = 0, pl_orbsmax = 1, unit = "wm2")# Solar-type star, Earth-like orbit calculate_stellar_flux(st_lum = 0, pl_orbsmax = 1) # Linear luminosity input (not log), 5x Sun at 2 AU calculate_stellar_flux(st_lum = 5, pl_orbsmax = 2, log_lum = FALSE) # Output in absolute units (W/m²), Earth-like conditions calculate_stellar_flux(st_lum = 0, pl_orbsmax = 1, unit = "wm2")
This function returns a compact four-character code representing the classification of an exoplanet based on its mass, equilibrium temperature, orbital eccentricity, and density.
The classification code is composed of four parts:
Mass class:
M: Mercury-like planets (< 0.22 Earth masses)
E: Earth-like planets (0.22–2.2 Earth masses)
S: Super-Earths (2.2–22 Earth masses)
N: Neptune-like planets (22–127 Earth masses)
J: Jupiter-like giants (127–4450 Earth masses)
D: Degenerate-matter/brown dwarf-like objects (>= 4450 Earth masses)
Temperature class:
F: Frozen (T < 250 K)
W: Temperate/water zone (250–450 K)
G: Gaseous (450–1000 K)
R: Roasters (>= 1000 K)
Eccentricity:
First decimal digit of orbital eccentricity.
For example, 0.26 → 3 → appended as 3.
Density-based surface/composition class:
g: Gas-dominated (< 0.25 g/cm³)
w: Water/ice-rich (0.25–2 g/cm³)
t: Terrestrial/rocky (2–6 g/cm³)
i: Iron-rich (6–13 g/cm³)
s: Super-dense (>= 13 g/cm³)
classify_planet_type(pl_bmasse, pl_eqt, pl_orbeccen, pl_dens)classify_planet_type(pl_bmasse, pl_eqt, pl_orbeccen, pl_dens)
pl_bmasse |
Numeric. Planetary mass in Earth masses. Must be > 0. |
pl_eqt |
Numeric. Planetary equilibrium temperature in Kelvin. Must be > 0. |
pl_orbeccen |
Numeric. Orbital eccentricity. Must be > 0. |
pl_dens |
Numeric. Planetary density in g/cm³. Must be > 0. |
A character string containing a 4-character planet classification code.
classify_planet_type(1.0, 288, 0.0167, 5.5) # Earth-like: "EW0t" classify_planet_type(318, 1300, 0.05, 1.3) # Hot Jupiter: "JR3w" classify_planet_type(0.1, 180, 0.2, 0.1) # Cold, light, low-density: "MF2g"classify_planet_type(1.0, 288, 0.0167, 5.5) # Earth-like: "EW0t" classify_planet_type(318, 1300, 0.05, 1.3) # Hot Jupiter: "JR3w" classify_planet_type(0.1, 180, 0.2, 0.1) # Cold, light, low-density: "MF2g"
The function takes in effective stellar temperature (in K), and return letter for the star's spectral type based on Morgan–Keenan (MK) system.
classify_star_spectral_type(st_teff)classify_star_spectral_type(st_teff)
st_teff |
Numeric. effective stellar temperature (in K) |
Character. spectral type classification with a letter:
M: 2,500 - 3,500
K: 3,500 - 5,000
G: 5,000 - 6,000
F: 6,000 - 7,500
A: 7,500 - 10,000
B: 10,000 - 28,000
O: 28,000 - 50,000
classify_star_spectral_type(5778)classify_star_spectral_type(5778)
A sample dataset of 50 exoplanets closest to earth,
taken from table Planetary Systems Composite Parameters,
including their names, discovery methods,
and other relevant information.
closest_50_exoplanetsclosest_50_exoplanets
A data frame with 683 columns and 50 rows.
https://exoplanetarchive.ipac.caltech.edu/
ps and pscomppars tablesexoplanets_col_labels
A collection of Exoplanets archive columns names and their respective labels / comments.
Currently only supports ps and pscomppars tables
exoplanets_col_labelsexoplanets_col_labels
named vectors nested in a list.
https://exoplanetarchive.ipac.caltech.edu/docs/API_PS_columns.html#columns
exoplanets_col_labels[["ps"]][["Planet Name"]]exoplanets_col_labels[["ps"]][["Planet Name"]]
Fetch Exoplanets table
fetch_table( table, query_string = NULL, pretty_colnames = FALSE, format = "csv" )fetch_table( table, query_string = NULL, pretty_colnames = FALSE, format = "csv" )
table |
A string specifying the table to query. Must be one of:
|
query_string |
Optional ADQL |
pretty_colnames |
Optional |
format |
Optional |
Fetches data from an exoplanets TAP (Table Access Protocol) service
and returns it as a data frame or a named list.
You can optionally specify WHERE ADQL clause to filter rows based on conditions.
A data frame or named list containing fetched data.
# All entries from Stellar Hosts table fetch_table("stellarhosts") # Entries from Planetary Systems table where planetary mass > 3 times the earth mass fetch_table("ps", query_string = "pl_bmasse > 3") # Planets orbiting Teegarden's Star with radius > 1 Earth radius fetch_table("pscomppars", query_string = "hostname = 'Teegarden''s Star' and pl_rade > 1")# All entries from Stellar Hosts table fetch_table("stellarhosts") # Entries from Planetary Systems table where planetary mass > 3 times the earth mass fetch_table("ps", query_string = "pl_bmasse > 3") # Planets orbiting Teegarden's Star with radius > 1 Earth radius fetch_table("pscomppars", query_string = "hostname = 'Teegarden''s Star' and pl_rade > 1")
Module Displaying Planet Details
planet_details_ui(id) planet_details_server(id, planet_info)planet_details_ui(id) planet_details_server(id, planet_info)
id |
A unique identifier for the module. |
planet_info |
A reactive expression returning a data frame with information about the planet. |
This module provides a dynamically refreshing table component for displaying basic information about a planet.
A Shiny UI object.
planet_details_ui(): UI function for the planet details module.
planet_details_server(): server function for the planet details module.
Search Module
search_ui(id, label = "Search...", multiple = FALSE, random = FALSE) search_server(id, choices, start_random = FALSE)search_ui(id, label = "Search...", multiple = FALSE, random = FALSE) search_server(id, choices, start_random = FALSE)
id |
A unique identifier for the module. |
label |
The label text for the select input. |
multiple |
Whether to allow multiple selections (default: FALSE). |
random |
Whether to show a randomize button (default: FALSE). |
choices |
A reactive expression that returns a vector of choices for the select input. |
start_random |
Whether to select a random value when choices are updated. |
This module provides a reusable search component with a select input and optional randomize button. It can be used to create searchable drop-downs with support for multiple selection and random choice selection. The module handles updating choices dynamically and provides a reactive value for the selected item(s).
A Shiny UI object.
A reactive expression containing the selected value(s).
search_ui(): UI function for the search module.
search_server(): Server function for the search module.
Star Systems Module
star_systems_ui(id) star_systems_server(id, data)star_systems_ui(id) star_systems_server(id, data)
id |
A unique identifier for the module. |
data |
A reactive expression that returns a data frame containing star system data. |
This module provides functionality for exploring star systems and their planets. Provides a handy UI for selecting a star system. The star is visualized alongside its planets and their orbits. The display provides basic information about the system itself, as well as particular planets. A legend is available for the plot.
A Shiny UI object.
A Shiny server module.
star_systems_ui(): UI function for the module.
star_systems_server(): Server function for the module.
Module Displaying Star System Info with Value Boxes (Two Rows)
system_info_ui(id) system_info_server(id, system_info)system_info_ui(id) system_info_server(id, system_info)
id |
A unique identifier for the module. |
system_info |
A reactive expression returning a data frame with information about the system. |
A Shiny UI object.
system_info_ui(): UI function for the system info module using value boxes.
system_info_server(): Server function for the system info module using value boxes.
System Plot Settings Module
system_plot_settings_ui(id) system_plot_settings_server(id)system_plot_settings_ui(id) system_plot_settings_server(id)
id |
A unique identifier for the module. |
This module provides a series of controls to customize the visible elements of a star system map
A Shiny UI object.
A reactive list object containing bool value whether to show the habitable zone and plot legend.
system_plot_settings_ui(): UI function for the plot settings module.
system_plot_settings_server(): function for the search module.
Module Visualizing Star Systems
visualize_star_system_ui(id) visualize_star_system_server(id, plot_data, show_hz, show_legend)visualize_star_system_ui(id) visualize_star_system_server(id, plot_data, show_hz, show_legend)
id |
A unique identifier for the module. |
plot_data |
A reactive expression returning a data frame with information about the system. |
show_hz |
A reactive boolean expression determining whether to show habitable zone. |
show_legend |
A reactive boolean expression determining whether to show plot legend. |
This module provides a dynamically refreshing plot component for visualizing star systems based on data provided
A Shiny UI object.
visualize_star_system_ui(): UI function for the system mapping module.
visualize_star_system_server(): server function for the system mapping module.
Creates a stylized polar plot of a planetary system, displaying planets in circular orbits around a central star. Planet size is scaled by radius, orbit position is randomized for aesthetics, planet color is mapped by density. The star's color is optionally based on spectral type. Optionally, star's habitable zone visualization can be overlayed.
plot_star_system( planet_data, spectral_type = " ", habitable_zone = c(0, 0), show_legend = FALSE )plot_star_system( planet_data, spectral_type = " ", habitable_zone = c(0, 0), show_legend = FALSE )
planet_data |
A data frame containing planetary system data. Must include:
|
spectral_type |
Optional character string indicating the star's spectral type.
Accepted values: |
habitable_zone |
Optional numeric vector containing 2 values: Inner and outer habitable zone edges in AU. |
show_legend |
Optional bool value, whether to show plot legend. |
The central star is positioned at the origin with planets arranged in orbits of increasing radius. Orbit lines are shown in gray for clarity.
A ggplot2 object representing the planetary system visualization.
# Plot system GJ 682 (with hostid == "2.101289") data = closest_50_exoplanets |> subset(hostid == 2.101289) spectral_type = classify_star_spectral_type(data$st_teff[1]) plot_star_system(data, spectral_type, habitable_zone = calculate_star_habitable_zone(data$st_lum[1]))# Plot system GJ 682 (with hostid == "2.101289") data = closest_50_exoplanets |> subset(hostid == 2.101289) spectral_type = classify_star_spectral_type(data$st_teff[1]) plot_star_system(data, spectral_type, habitable_zone = calculate_star_habitable_zone(data$st_lum[1]))
Creates a log-log scatterplot of planetary radius versus stellar flux, colored by the Earth Similarity Index (ESI).
scatterplot_esi(data, plot_limits = c(0.1, 10))scatterplot_esi(data, plot_limits = c(0.1, 10))
data |
A data frame containing exoplanet data. Must include the columns:
|
plot_limits |
A numeric vector of length 2 specifying the lower and upper bounds.
Default is |
Dashed lines at (1,1) indicate Earth's reference values for stellar flux and radius.
A ggplot2 object representing the scatterplot.
closest_50_exoplanets |> dplyr::mutate(esi = calculate_esi(radius = pl_rade, flux = pl_insol)) |> scatterplot_esi()closest_50_exoplanets |> dplyr::mutate(esi = calculate_esi(radius = pl_rade, flux = pl_insol)) |> scatterplot_esi()
Summarize star occurrences
summarize_star_occurrences(data)summarize_star_occurrences(data)
data |
A data frame with KOI data. Must contain |
The function takes in KOI data frame and summarizes the number of planets that appear in a given dataset for each star.
A data frame containing:
- Star column with star ID.
- Count column with number of planets.
Trim planetary systems table
trim_ps_table(data)trim_ps_table(data)
data |
A data frame with planetary systems data. |
The function takes in a planetary systems data frame, and trims it to include only 20 most important columns.
A data frame containing:
objectid - Object ID
pl_name – Planet name
hostname – Host star name
sy_dist – Distance to the system (parsecs)
pl_rade – Planetary radius (Earth radii)
pl_bmasse – Planetary mass (Earth masses)
pl_orbper – Orbital period (days)
pl_orbsmax – Semi-major axis (AU)
pl_orbeccen – Orbital eccentricity
pl_insol – Incident stellar flux (Earth units)
st_teff – Stellar effective temperature (K)
st_rad – Stellar radius (Solar radii)
st_mass – Stellar mass (Solar masses)
st_lum – Stellar luminosity (log10 L/Lsun)
pl_eqt – Planetary equilibrium temperature (K)
pl_dens – Planetary density
discoverymethod – Discovery method
disc_year – Year of discovery
sy_snum – Number of stars in system
sy_pnum – Number of planets in system
trim_ps_table(closest_50_exoplanets)trim_ps_table(closest_50_exoplanets)