forked from xspanger3770/GlobalQuake
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from xspanger3770/develop
Dev merge from upstream
- Loading branch information
Showing
220 changed files
with
6,333 additions
and
5,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletions
198
.construction_tools/revised_EMSC_region_data/dataset_viewer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" /> | ||
</head> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
#mapid { | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
right: 0; | ||
left: 0; | ||
z-index: 10; | ||
} | ||
|
||
#loadButton { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
|
||
padding: 8px; | ||
|
||
font-size: large; | ||
height: fit-content; | ||
width: fit-content; | ||
|
||
border-radius: 8px; | ||
|
||
background-color: blue; | ||
|
||
z-index: 1001; | ||
} | ||
|
||
.dragOver { | ||
background-color: black; | ||
opacity: 0.5; | ||
} | ||
|
||
|
||
</style> | ||
|
||
<body> | ||
<div id="map" style="width: 100%; height: 100vh;"></div> | ||
<input type="file" id="fileInput" onchange="loadFileFromUserInput(event)" accept=".geojson" style="display: none;"> | ||
<button id="loadButton" onclick="loadButtonClicked()">Load GeoJSON<br>or drag and drop</button> | ||
|
||
</body> | ||
|
||
<script> | ||
function preventDefaults (e) { | ||
e.preventDefault() | ||
e.stopPropagation() | ||
} | ||
// Prevent default drag behaviors | ||
;['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | ||
document.body.addEventListener(eventName, preventDefaults, false) | ||
}) | ||
|
||
function loadButtonClicked() { | ||
loadingDialog(true); | ||
document.getElementById('fileInput').click(); | ||
} | ||
|
||
function loadingDialog(show){ | ||
let button = document.getElementById('loadButton'); | ||
if(show){ | ||
button.innerText = 'Loading...'; | ||
button.style.color = 'gray'; | ||
} | ||
else{ | ||
button.innerHTML = 'Load GeoJSON<br>or drag and drop'; | ||
button.style.color = 'white'; | ||
} | ||
|
||
button.disabled = show; | ||
} | ||
|
||
function dragOverEventHandler(e) { | ||
let dz = document.getElementById('loadButton'); | ||
dz.classList.add('dragOver'); | ||
} | ||
|
||
function dragLeaveEventHandler(e) { | ||
let dz = document.getElementById('loadButton'); | ||
dz.classList.remove('dragOver'); | ||
} | ||
|
||
// Handle dropped files | ||
function handleDrop(e) { | ||
loadingDialog(true); | ||
dragLeaveEventHandler(e); | ||
let files = e.dataTransfer.files; | ||
if(! files.length) { | ||
return | ||
} | ||
|
||
for (let i = 0; i < files.length; i++) { | ||
loadFileAndShow(files[i]); | ||
} | ||
} | ||
|
||
document.getElementById('loadButton').addEventListener('dragenter', dragOverEventHandler, false) | ||
|
||
document.getElementById('loadButton').addEventListener('dragleave', dragLeaveEventHandler, false) | ||
|
||
document.getElementById('loadButton').addEventListener('drop', handleDrop, false) | ||
|
||
document.getElementById("fileInput").addEventListener("cancel", function() { | ||
loadingDialog(false); | ||
}); | ||
|
||
function getRandomColor() { | ||
let letters = '0123456789ABCDEF'; | ||
let color = '#'; | ||
for (var i = 0; i < 6; i++) { | ||
color += letters[Math.floor(Math.random() * 16)]; | ||
} | ||
return color; | ||
} | ||
|
||
function onEachFeature(feature, layer) { | ||
// Create popup content from feature properties | ||
let popupContent = ""; | ||
for (let property in feature.properties) { | ||
popupContent += property + ": " + feature.properties[property] + "<br>"; | ||
} | ||
layer.bindPopup(popupContent); | ||
} | ||
|
||
function styleFeature(feature) { | ||
return { | ||
fillColor: getRandomColor(), | ||
fillOpacity: 0.8, | ||
weight: 2 | ||
}; | ||
} | ||
|
||
function centerMapToFeatures() { | ||
let layers = map._layers; | ||
let bounds = null; | ||
|
||
for (let layer in layers) { | ||
if (layers[layer]._latlngs) { | ||
if (!bounds) { | ||
bounds = layers[layer].getBounds(); | ||
} else { | ||
bounds.extend(layers[layer].getBounds()); | ||
} | ||
} | ||
} | ||
|
||
if (bounds) { | ||
map.fitBounds(bounds); | ||
} | ||
} | ||
|
||
function loadFileFromUserInput(event) { | ||
loadingDialog(true); | ||
let file = event.target.files[0]; | ||
|
||
if (!file) { | ||
loadingDialog(false); | ||
return; | ||
} | ||
|
||
loadFileAndShow(file); | ||
} | ||
|
||
function loadFileAndShow(file){ | ||
let reader = new FileReader(); | ||
reader.onload = function(e) { | ||
let data = JSON.parse(e.target.result); | ||
L.geoJSON(data, { | ||
style: styleFeature, // Apply random color style | ||
onEachFeature: onEachFeature // Handle each feature | ||
}).addTo(map); | ||
centerMapToFeatures(); | ||
loadingDialog(false); | ||
}; | ||
reader.readAsText(file); | ||
} | ||
|
||
// Create Leaflet map | ||
var map = L.map('map').setView([51.505, -0.09], 5); | ||
|
||
// Add base tiles (e.g., OpenStreetMap) | ||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | ||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | ||
}).addTo(map); | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# Specify the values of BLOCK_HYPOCS and TILE | ||
BLOCK_HYPOCS_VALUES=(256 384 512 768) | ||
TILE_VALUES=(4 5 6 7 8 9 10 11 12 13 14) | ||
|
||
#BLOCK_HYPOCS_VALUES=(32) | ||
#TILE_VALUES=(5) | ||
|
||
DEFAULT_TESTS=12 | ||
TESTS=${1:-$DEFAULT_TESTS} | ||
|
||
filename="autotune_results.csv" | ||
|
||
# Remove the existing file if it exists | ||
rm -f "$filename" | ||
touch "$filename" | ||
echo "BLOCK_HYPOCS,TILE,Best_PPS">"$filename" | ||
|
||
# Create the build directory if it doesn't exist | ||
mkdir -p build | ||
|
||
# CD into the build directory | ||
cd build | ||
|
||
# Loop over BLOCK_HYPOCS values | ||
for BLOCK_HYPOCS in "${BLOCK_HYPOCS_VALUES[@]}"; do | ||
# Loop over TILE values | ||
for TILE in "${TILE_VALUES[@]}"; do | ||
# Run cmake with specified BLOCK_HYPOCS and TILE values | ||
cmake -DBLOCK_HYPOCS=$BLOCK_HYPOCS -DTILE=$TILE -DTESTS=$TESTS .. | ||
|
||
# Compile the project using make | ||
make | ||
|
||
# Optionally, run your project here if needed | ||
./bin/gq_test | ||
|
||
# Optionally, clean the build directory after each iteration | ||
# make clean | ||
done | ||
done | ||
|
||
cd .. | ||
|
||
highest_value=$(awk -F';' 'NR > 1 {print $3}' "$filename" | sort -n -r | head -n 1) | ||
|
||
# Use grep to find the entire row with the highest value in the third column | ||
row=$(grep "$highest_value" "$filename") | ||
|
||
echo "Best solution:" | ||
echo "$row" | ||
echo "$row">best_solution.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.