Skip to content

Commit

Permalink
Merge branch 'main' into integration_times
Browse files Browse the repository at this point in the history
  • Loading branch information
juanep97 authored Oct 9, 2024
2 parents b98b013 + 858052a commit 8629613
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 5 deletions.
8 changes: 4 additions & 4 deletions iop4admin/modeladmins/astrosource.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def add_field_stars_from_panstarrs(self, request, queryset):

logger.info(f"Got {len(catalog_data)} PanSTARRS field stars around {main_src.name}")


column_names = ['objName', 'raMean', 'decMean',
'rMeanApMag', 'rMeanApMagErr', 'rMeanApMagStd', 'rMeanApMagNpt',
'gMeanApMag', 'gMeanApMagErr', 'gMeanApMagStd', 'gMeanApMagNpt',
Expand All @@ -150,9 +149,10 @@ def add_field_stars_from_panstarrs(self, request, queryset):

for col in column_names:

idx = np.isfinite(catalog_data[col])
idx = idx.data & idx.mask
catalog_data = catalog_data[~idx]
if np.issubdtype(catalog_data.dtype[col], np.number):
idx = np.isfinite(catalog_data[col])
idx = idx.data & idx.mask
catalog_data = catalog_data[~idx]

idx = (MIN_R_MAG <= catalog_data["rMeanApMag"]) & (catalog_data["rMeanApMag"] <= MAX_R_MAG)
idx = idx & (catalog_data["rMeanApMagStd"] < MAX_MAG_STD)
Expand Down
40 changes: 39 additions & 1 deletion iop4api/templates/iop4api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h2><a href="https://vhega.iaa.es/">VHEGA@IAA-CSIC</a></h2>
selectedTabs: [C1selectedTab_0, C2selectedTab_0],
// log
logEntries: [],
// plot
// plot (also uses input_astrosource in query vars)
showPlot: false,
plot_config_fast: true,
enable_full_lc: false,
Expand All @@ -121,6 +121,8 @@ <h2><a href="https://vhega.iaa.es/">VHEGA@IAA-CSIC</a></h2>
use_hostcorrected: false,
plot_config_band: 'R',
plot_config_band_options: ['R', 'V', 'B', 'U', 'I'],
input_date_start: '',
input_date_end: '',
// plot (flagging)
selected_plot_idx: [],
show_selected_plot_pts: false,
Expand Down Expand Up @@ -331,6 +333,9 @@ <h2><a href="https://vhega.iaa.es/">VHEGA@IAA-CSIC</a></h2>
},
methods: {
updateURL() {
// Get the current query parameters
const currentParams = window.location.search;

// Start forming the new URL based on the selected tabs
let newURL = '/iop4/';

Expand All @@ -354,6 +359,9 @@ <h2><a href="https://vhega.iaa.es/">VHEGA@IAA-CSIC</a></h2>
}
}

// Append the original query parameters to the new URL
newURL += currentParams;

window.history.pushState({}, '', newURL);
},
updateSelectedTabFromPath() {
Expand Down Expand Up @@ -404,6 +412,21 @@ <h2><a href="https://vhega.iaa.es/">VHEGA@IAA-CSIC</a></h2>
}
return Number(value).toFixed(precision);
},
// auto load plot from url (e.g. /iop4/explore/plot/?srcname=2200%2B420&from=2024-01-01&to=2024-09-01)
autoSubmitPlotForm() {
load_source_plot(document.getElementById('plot_astrosource_form'));
},
getPlotQueryParams() {
const params = new URLSearchParams(window.location.search);
return {
srcname: params.get('srcname') || '',
date1: params.get('from') || '',
date2: params.get('to') || '',
band: params.get('band') || 'R',
fast: params.get('fast') || 'false',
errors: params.get('errors') || 'true',
};
},
},
beforeMount() {
this.updateSelectedTabFromPath();
Expand All @@ -412,6 +435,21 @@ <h2><a href="https://vhega.iaa.es/">VHEGA@IAA-CSIC</a></h2>
window.addEventListener('popstate', () => {
this.updateSelectedTabFromPath();
});
// auto load plot from url
const params = this.getPlotQueryParams();
this.input_astrosource = params.srcname;
this.input_date_start = params.date1;
this.input_date_end = params.date2;
this.plot_config_band = params.band;
this.plot_config_fast = params.fast === 'true';
this.enable_errorbars = params.errors === 'true';

if (this.input_astrosource) { // && this.input_date_start && this.input_date_end) {
console.log('auto plotting from url with params', params);
Vue.nextTick(() => {
this.autoSubmitPlotForm();
});
}
}
}).use(Quasar).mount('#app')

Expand Down

0 comments on commit 8629613

Please sign in to comment.