Skip to content

Commit

Permalink
Merge pull request #130 from LCOGT/fix/output-analysis
Browse files Browse the repository at this point in the history
Fixes for datalab output analysis
  • Loading branch information
LTDakin authored Dec 4, 2024
2 parents ed16f79 + 7cff85d commit f917200
Show file tree
Hide file tree
Showing 8 changed files with 180 additions and 559 deletions.
447 changes: 21 additions & 426 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"dependencies": {
"@geoman-io/leaflet-geoman-free": "^2.17.0",
"@mdi/font": "5.9.55",
"chart.js": "^4.4.6",
"core-js": "^3.8.3",
"d3": "^7.9.0",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"lru-cache": "^10.2.0",
Expand All @@ -21,7 +21,6 @@
"serve": "^14.2.1",
"vue": "^3.5.9",
"vue-router": "^4.2.5",
"vue3-carousel": "^0.3.1",
"vuetify": "^3.7.4",
"webfontloader": "^1.0.0"
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/Project/CreateSessionDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ async function addImagesToExistingSession(session){
const inputData = [...existingSession.input_data, ...props.newImages.map(image => ({
'source': 'archive',
'basename': image.basename.replace('-small', '') || image.basename.replace('-large', ''),
'id': image.id,
'url': image.url,
'filter': image.FILTER
}))]
const requestBody = {
Expand All @@ -57,6 +59,8 @@ async function createNewDataSession(){
const inputData = props.newImages.map(image => ({
'source': 'archive',
'basename': image.basename.replace('-small', '') || image.basename.replace('-large', ''),
'id': image.id,
'url': image.url,
'filter': image.FILTER
}))
const requestBody = {
Expand Down
13 changes: 9 additions & 4 deletions src/components/Project/ImageAnalysis/ImageAnalyzer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function closeDialog() {
startCoords.value = null
endCoords.value = null
headerData.value = null
positionAngle.value = null
emit('update:modelValue', false)
}
Expand All @@ -47,6 +48,7 @@ function requestAnalysis(action, input, action_callback=null){
const url = configStore.datalabApiBaseUrl + 'analysis/' + action + '/'
const body = {
'basename': props.image.basename,
'source': props.image.source,
...input
}
fetchApiCall({url: url, method: 'POST', body: body, successCallback: (response) => {handleAnalysisOutput(response, action, action_callback)}})
Expand Down Expand Up @@ -111,10 +113,13 @@ function showHeaderDialog() {
/>
<v-toolbar-title>{{ image.basename || "Unknown" }}</v-toolbar-title>
<image-download-menu
:image="image"
:image-name="image.basename"
:fits-url="image.url || image.fits_url"
:jpg-url="image.largeCachedUrl"
@analysis-action="requestAnalysis"
/>
<v-btn
v-if="image.id"
icon="mdi-information"
@click="showHeaderDialog"
/>
Expand Down Expand Up @@ -145,8 +150,8 @@ function showHeaderDialog() {
rounded
>
<line-plot
:y-axis-luminosity="lineProfile"
:x-axis-arcsecs="lineProfileLength"
:y-axis-data="lineProfile"
:x-axis-length="lineProfileLength"
:start-coords="startCoords"
:end-coords="endCoords"
:position-angle="positionAngle"
Expand Down Expand Up @@ -212,11 +217,11 @@ a{
}
.basic-info-sheet{
padding: 1rem;
margin-bottom: 1rem;
color: var(--tan);
background-color: var(--metal);
}
.line-plot-sheet {
margin-top: 1rem;
padding: 1rem;
background-color: var(--metal);
height: 100%;
Expand Down
27 changes: 23 additions & 4 deletions src/components/Project/ImageAnalysis/ImageDownloadMenu.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
<script setup>
import { useAlertsStore } from '@/stores/alerts'
const props = defineProps(['image', 'tifUrl'])
const props = defineProps({
imageName: {
type: String,
required: true,
default: null,
},
fitsUrl: {
type: String,
required: false,
default: null,
},
jpgUrl: {
type: String,
required: false,
default: null,
},
})
defineEmits(['analysisAction'])
Expand All @@ -12,6 +28,7 @@ function downloadLink(link, filename, fileType='file'){
alertStore.setAlert('error', `No ${fileType} available for download`)
return
}
// Create a link element and click it to download the file
const a = document.createElement('a')
a.href = link
a.download = filename
Expand All @@ -33,19 +50,21 @@ function downloadLink(link, filename, fileType='file'){
/>
</template>
<v-btn
v-if="props.fitsUrl"
key="1"
text=".FITS"
@click="downloadLink(props.image.url, props.image.basename, 'FITs')"
@click="downloadLink(props.fitsUrl, props.imageName, 'FITs')"
/>
<v-btn
key="2"
text=".TIF"
@click="$emit('analysisAction', 'get-tif', {'basename': props.image.basename}, downloadLink)"
@click="$emit('analysisAction', 'get-tif', {'basename': props.imageName}, downloadLink)"
/>
<v-btn
v-if="props.jpgUrl"
key="3"
text=".JPG"
@click="downloadLink(props.image.largeCachedUrl, props.image.basename, 'JPG')"
@click="downloadLink(props.jpgUrl, props.imageName, 'JPG')"
/>
</v-speed-dial>
</template>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Project/ImageAnalysis/ImageViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ function loadImageOverlay() {
maxBoundsViscosity: 1.0,
})
// Layer control allows the toggling of layers on the map
layerControl = L.control.layers(null, null, {collapsed:false}).addTo(imageMap)
const img = new Image()
img.src = props.imageSrc
Expand Down Expand Up @@ -206,7 +203,7 @@ function createCatalogLayer(){
snapIgnore: false, // Allow snapping to this layer
})
sourceMarker.bindPopup(`Flux: ${source.flux}<br>Ra: ${source.ra}<br>Dec: ${source.dec}`)
sourceMarker.bindPopup(`Flux: ${source.flux ?? 'N/A'}<br>Ra: ${source.ra ?? 'N/A'}<br>Dec: ${source.dec ?? 'N/A'}`)
sourceCatalogMarkers.push(sourceMarker)
})
Expand All @@ -216,6 +213,9 @@ function createCatalogLayer(){
// Displays the catalog layer by default
catalogLayerGroup.addTo(imageMap)
// Layer control allows the toggling of layers on the map
layerControl = L.control.layers(null, null, {collapsed:false}).addTo(imageMap)
layerControl.addOverlay(catalogLayerGroup, 'Source Catalog')
}
Expand Down
Loading

0 comments on commit f917200

Please sign in to comment.