Skip to content

Commit

Permalink
add jwst custom version
Browse files Browse the repository at this point in the history
  • Loading branch information
lmytime committed Jun 16, 2023
1 parent 1c5f11f commit 481268a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 31 deletions.
1 change: 1 addition & 0 deletions myfilter_frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<div class="main">
<div class="left-container">
<div class="title">AstroMy™ Filter</div>
<div v-html="cusComment"></div>
<el-card style="text-align: left; font-size: small; width: 80%; margin: 0 auto;">
<h2 @click="readmeDialog = !readmeDialog" style="cursor: pointer;"
v-text="`${readmeDialog ? 'README ↓' : 'README -'}`"></h2>
Expand Down
75 changes: 44 additions & 31 deletions myfilter_frontend/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ const app = Vue.createApp({
g: "",
redshift: 0,
lines: "",
cusComment: "",
defaultLines: "",
FilterIndexing: FilterIndexing,
selectedIntrument:[],
selectedIntrument: [],
filter: [],
filterInit: [],
filterInitDefault: ["CFHT/MegaCam.u", "Subaru/HSC.g", "Subaru/HSC.r", "Subaru/HSC.i", "Subaru/HSC.z", "Subaru/HSC.Y"],
zInit: 2,
zInitDefault: 2,
title: "",
dialogFormVisible: false,
form: {
name: "",
Expand Down Expand Up @@ -98,7 +100,7 @@ const app = Vue.createApp({
if (query) {
this.loading = true
this.lineOptions = this.linList.filter((item) => {
return (item.name+"|"+item.w).toLowerCase().includes(query.replace(/\s/g, '').toLowerCase())
return (item.name + "|" + item.w).toLowerCase().includes(query.replace(/\s/g, '').toLowerCase())
})
this.loading = false
} else {
Expand Down Expand Up @@ -129,7 +131,7 @@ const app = Vue.createApp({
this.selectedIntrument.push(value)
this.InstrumentValue = ""
},
getSelectedFilterNumber(childen){
getSelectedFilterNumber(childen) {
let count = 0
for (let ff of childen) {
if (ff.checked) {
Expand All @@ -138,7 +140,7 @@ const app = Vue.createApp({
}
return count
},
deleteSelectedInstrument(instrument){
deleteSelectedInstrument(instrument) {
// all filter set to unchecked
for (let ff of instrument.children) {
ff.checked = false
Expand Down Expand Up @@ -175,9 +177,9 @@ const app = Vue.createApp({
})
const CopyNotification = () => {
ElementPlus.ElNotification({
title: 'Link copied to clipboard!',
type: 'success',
duration: 4000,
title: 'Link copied to clipboard!',
type: 'success',
duration: 4000,
})
}
CopyNotification();
Expand Down Expand Up @@ -217,22 +219,33 @@ const app = Vue.createApp({
(acc, val) => ({ ...acc, [val]: params.get(val) }),
{}
);
this.cus = paramsObj.cus ? paramsObj.cus : this.cusDefault

if (this.cus == 'JWST') {
this.title = this.cus + " Filter";
this.cusComment = "This is " + this.cus + " customamized version.<br>Go to general version <a target='_blank' href='https://preview.lmytime.com/myfilter'>here</a>."
this.filterInitDefault = ["JWST/NIRCam.F090W", "JWST/NIRCam.F115W", "JWST/NIRCam.F150W", "JWST/NIRCam.F200W",
"JWST/NIRCam.F277W", "JWST/NIRCam.F356W", "JWST/NIRCam.F444W"]
this.zInitDefault = 6.0
}

this.filterInit = paramsObj.fil ? paramsObj.fil.split(',') : this.filterInitDefault
this.zInit = paramsObj.z ? parseFloat(paramsObj.z) : this.zInitDefault

const CustomInitNotification = () => {
ElementPlus.ElNotification({
title: 'Custom Initialization Success',
dangerouslyUseHTMLString: true,
message: `<strong><i>MyFilter</i> app is successfully initialized with the custom-selected filters and redshift.
title: 'Custom Initialization Success',
dangerouslyUseHTMLString: true,
message: `<strong><i>MyFilter</i> app is successfully initialized with the custom-selected filters and redshift.
You can share the link with others to show the same filter set and redshift.</strong>`,
type: 'success',
type: 'success',
})
}

if((this.filterInit == this.filterInitDefault) && (this.zInit == this.zInitDefault)){

if ((this.filterInit == this.filterInitDefault) && (this.zInit == this.zInitDefault)) {
this.shareLinkVisible = false
} else{
} else {
this.shareLinkVisible = true
CustomInitNotification()
}
Expand Down Expand Up @@ -281,23 +294,23 @@ const app = Vue.createApp({

this.g = new Dygraph(document.getElementById("dygraph"),
`https://preview.lmytime.com/getfilter?${this.filterInit.join('&')}`, {
// title: 'AstroMy™ Filter',
xlabel: 'Wavelength [Å]',
ylabel: 'Transmittance',
legend: 'always',
fillGraph: true,
rollPeriod: 1,
animatedZooms: true,
interactionModel: Dygraph.MyInteractionModel,
underlayCallback: this.underlaycallback,
labelsShowZeroValues: false,
labelsSeparateLines: true,
legendFormatter: legendFormatter,
axisTickSize: 5,
axisLineWidth: 2,
strokeWidth: 2,
fillAlpha: 0.3
});
title: this.title,
xlabel: 'Wavelength [Å]',
ylabel: 'Transmittance',
legend: 'always',
fillGraph: true,
rollPeriod: 1,
animatedZooms: true,
interactionModel: Dygraph.MyInteractionModel,
underlayCallback: this.underlaycallback,
labelsShowZeroValues: false,
labelsSeparateLines: true,
legendFormatter: legendFormatter,
axisTickSize: 5,
axisLineWidth: 2,
strokeWidth: 2,
fillAlpha: 0.3
});


for (let fil of this.filterInit) {
Expand All @@ -321,5 +334,5 @@ const app = Vue.createApp({
app.use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
}
app.mount('#app')

0 comments on commit 481268a

Please sign in to comment.