mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-23 20:49:00 -06:00
Merge branch 'master' into feature/camera-control-during-path
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
local dataFolder = "D:/dev/exoplanets data config"
|
||||
local dataFolder = "D:/data/prepared_exoplanets_data"
|
||||
return {
|
||||
{
|
||||
Type = "ExoplanetsDataPreparationTask",
|
||||
|
||||
InputDataFile = dataFolder .. "/exoplanets_data_composite.csv",
|
||||
InputSPECK = "${SYNC}/http/digitaluniverse_exoplanets_speck/1/expl.speck",
|
||||
TeffToBvFile = "${SYNC}/http/exoplanets_data/1/teff_bv.txt",
|
||||
InputDataFile = "${DATA}/tasks/exoplanets/downloaded_exo_data.csv",
|
||||
InputSPECK = "${SYNC}/http/digitaluniverse_exoplanets_speck/2/expl.speck",
|
||||
TeffToBvFile = "${SYNC}/http/exoplanets_data/2/teff_bv.txt",
|
||||
OutputBIN = dataFolder .. "/exoplanets_data.bin",
|
||||
OutputLUT = dataFolder .. "/lookup.txt"
|
||||
}
|
||||
|
||||
39
data/tasks/exoplanets/downloadexodata.py
Normal file
39
data/tasks/exoplanets/downloadexodata.py
Normal file
@@ -0,0 +1,39 @@
|
||||
##
|
||||
# Download most recent exoplanet data from NASA Exoplanet Archive using the TAP service
|
||||
# More info at: https://exoplanetarchive.ipac.caltech.edu/docs/TAP/usingTAP.html
|
||||
#
|
||||
# The data table is the Planetary Systems Composite dataset, where multiple sources have
|
||||
# been combined into one row per planet.
|
||||
# https://exoplanetarchive.ipac.caltech.edu/cgi-bin/TblView/nph-tblView?app=ExoTbls&config=PSCompPars
|
||||
#
|
||||
# The script downloads the columns needed for the visualization in OpenSpace and for the
|
||||
# exoplanets datapreparation task, but more columns can be added if needed.
|
||||
##
|
||||
|
||||
import pandas as pd
|
||||
|
||||
dataFileName = 'downloaded_exo_data.csv'
|
||||
|
||||
# The columns we need for the visualization in OpenSpace
|
||||
columns = 'pl_name,hostname,pl_letter,sy_snum,sy_pnum,pl_orbsmax,pl_orbsmaxerr1,pl_orbsmaxerr2,' \
|
||||
'pl_orbeccen,pl_orbeccenerr1,pl_orbeccenerr2,pl_orbincl,pl_orbinclerr1,pl_orbinclerr2,' \
|
||||
'pl_orblper,pl_orblpererr1,pl_orblpererr2,pl_orbper,pl_orbpererr1,pl_orbpererr2,' \
|
||||
'pl_radj,pl_radjerr1,pl_radjerr2,pl_tranmid,pl_tranmiderr1,pl_tranmiderr2,ra,dec,' \
|
||||
'sy_dist,st_rad,st_raderr1,st_raderr2,st_teff,st_tefferr1,st_tefferr2,' \
|
||||
'st_lum,st_lumerr1,st_lumerr2,cb_flag,disc_year'
|
||||
|
||||
# This may contain any extra conditions that one might want to fulfill. Start with a '+' sign
|
||||
where = ''
|
||||
|
||||
###
|
||||
## Download and save csv file
|
||||
print("Downloading all confirmed planets from NExSci's Exoplanets Archive... (Planetary Systems Composite Data table)")
|
||||
|
||||
NEW_API = 'https://exoplanetarchive.ipac.caltech.edu/TAP/sync?query='
|
||||
url = NEW_API + 'select+' + columns + '+from+pscomppars' + where + '&format=csv'
|
||||
print(url)
|
||||
df = pd.read_csv(url)
|
||||
|
||||
print("Writing data to file...")
|
||||
df.to_csv(dataFileName)
|
||||
print("Done!")
|
||||
@@ -42,10 +42,10 @@ namespace {
|
||||
|
||||
struct [[codegen::Dictionary(ExoplanetsDataPreparationTask)]] Parameters {
|
||||
// The csv file to extract data from
|
||||
std::filesystem::path inputDataFile;
|
||||
std::string inputDataFile;
|
||||
|
||||
// The speck file with star locations
|
||||
std::filesystem::path inputSPECK;
|
||||
std::string inputSPECK;
|
||||
|
||||
// The bin file to export data into
|
||||
std::string outputBIN [[codegen::annotation("A valid filepath")]];
|
||||
@@ -55,7 +55,7 @@ namespace {
|
||||
|
||||
// The path to a teff to bv conversion file. Should be a txt file where each line
|
||||
// has the format 'teff,bv'
|
||||
std::filesystem::path teffToBvFile;
|
||||
std::string teffToBvFile;
|
||||
};
|
||||
#include "exoplanetsdatapreparationtask_codegen.cpp"
|
||||
} // namespace
|
||||
@@ -71,11 +71,11 @@ ExoplanetsDataPreparationTask::ExoplanetsDataPreparationTask(
|
||||
{
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
_inputDataPath = absPath(p.inputDataFile.string());
|
||||
_inputSpeckPath = absPath(p.inputSPECK.string());
|
||||
_inputDataPath = absPath(p.inputDataFile);
|
||||
_inputSpeckPath = absPath(p.inputSPECK);
|
||||
_outputBinPath = absPath(p.outputBIN);
|
||||
_outputLutPath = absPath(p.outputLUT);
|
||||
_teffToBvFilePath = absPath(p.teffToBvFile.string());
|
||||
_teffToBvFilePath = absPath(p.teffToBvFile);
|
||||
}
|
||||
|
||||
std::string ExoplanetsDataPreparationTask::description() {
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace {
|
||||
constexpr const double AvoidCollisionDistanceRadiusMultiplier = 3.0;
|
||||
constexpr const double CollisionBufferSizeRadiusMultiplier = 1.0;
|
||||
constexpr const int MaxAvoidCollisionSteps = 10;
|
||||
|
||||
constexpr const double Epsilon = 1e-5;
|
||||
} // namespace
|
||||
|
||||
namespace openspace::interaction {
|
||||
@@ -76,20 +78,23 @@ AvoidCollisionCurve::AvoidCollisionCurve(const Waypoint& start, const Waypoint&
|
||||
_points.push_back(newPos);
|
||||
}
|
||||
|
||||
// Add point for moving out if the end state is in opposite direction
|
||||
glm::dvec3 startToEnd = end.position() - start.position();
|
||||
double cosAngleToTarget = glm::dot(normalize(-startViewDir), normalize(startToEnd));
|
||||
bool targetInOppositeDirection = cosAngleToTarget > 0.7;
|
||||
const glm::dvec3 startToEnd = end.position() - start.position();
|
||||
|
||||
if (targetInOppositeDirection) {
|
||||
const glm::dquat midleRot = glm::slerp(start.rotation(), end.rotation(), 0.5);
|
||||
const glm::dvec3 middleViewDir = ghoul::viewDirection(midleRot);
|
||||
const double stepOutDistance = 0.4 * glm::length(startToEnd);
|
||||
if (glm::length(startToEnd) > 0.0) {
|
||||
// Add point for moving out if the end state is in opposite direction
|
||||
double cosAngleToTarget = glm::dot(normalize(-startViewDir), normalize(startToEnd));
|
||||
bool targetInOppositeDirection = cosAngleToTarget > 0.7;
|
||||
|
||||
glm::dvec3 newPos = start.position() + 0.2 * startToEnd -
|
||||
stepOutDistance * glm::normalize(middleViewDir);
|
||||
if (targetInOppositeDirection) {
|
||||
const glm::dquat midleRot = glm::slerp(start.rotation(), end.rotation(), 0.5);
|
||||
const glm::dvec3 middleViewDir = ghoul::viewDirection(midleRot);
|
||||
const double stepOutDistance = 0.4 * glm::length(startToEnd);
|
||||
|
||||
_points.push_back(newPos);
|
||||
glm::dvec3 newPos = start.position() + 0.2 * startToEnd -
|
||||
stepOutDistance * glm::normalize(middleViewDir);
|
||||
|
||||
_points.push_back(newPos);
|
||||
}
|
||||
}
|
||||
|
||||
// Add an extra point to approach target
|
||||
@@ -119,11 +124,15 @@ void AvoidCollisionCurve::removeCollisions(int step) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int nSegments = static_cast<int>( _points.size() - 3);
|
||||
const int nSegments = static_cast<int>(_points.size() - 3);
|
||||
for (int i = 0; i < nSegments; ++i) {
|
||||
const glm::dvec3 lineStart = _points[i + 1];
|
||||
const glm::dvec3 lineEnd = _points[i + 2];
|
||||
|
||||
if (glm::distance(lineEnd, lineStart) - Epsilon < 0.0) {
|
||||
continue; // Start and end position are the same. Go to next segment
|
||||
}
|
||||
|
||||
for (SceneGraphNode* node : _relevantNodes) {
|
||||
// Do collision check in relative coordinates, to avoid huge numbers
|
||||
const glm::dmat4 modelTransform = node->modelTransform();
|
||||
|
||||
Reference in New Issue
Block a user