Skip to content

Commit

Permalink
Add some checks
Browse files Browse the repository at this point in the history
  • Loading branch information
eheinrich committed Aug 7, 2019
1 parent 2de64fa commit b0295fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions static/js/components/instrumentconfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ export default {
this.opticalElementUpdates;
let slitWidth = this.instrumentconfig.optical_elements.slit;
let readoutMode = this.instrumentconfig.mode;
if (this.configurationType === 'LAMP_FLAT' && slitWidth) {
if (this.configurationType === 'LAMP_FLAT' && slitWidth && readoutMode && this.selectedinstrument) {
return lampFlatDefaultExposureTime(slitWidth, this.selectedinstrument, readoutMode);
} else {
return undefined;
}
},
suggestedArcExposureTime: function() {
if (this.configurationType === 'ARC') {
if (this.configurationType === 'ARC' && this.selectedinstrument) {
return arcDefaultExposureTime(this.selectedinstrument);
} else {
return undefined;
Expand Down
9 changes: 5 additions & 4 deletions static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import $ from 'jquery';


function isSoarInstrument(instrumentType) {
return _.lowerCase(instrumentType).includes('soar');
return _.toLower(instrumentType).includes('soar');
}

function lampFlatDefaultExposureTime(slitWidth, instrumentType, readoutMode){
function lampFlatDefaultExposureTime(slitWidth, instrumentType, readoutMode) {
// Lamp flats are affected by the slit width, so exposure time needs to scale with it
readoutMode = _.toLower(readoutMode);
slitWidth = _.toLower(slitWidth);
if (isSoarInstrument(instrumentType)) {
if (readoutMode.includes('400m1')) {
return 3;
Expand All @@ -32,15 +34,14 @@ function lampFlatDefaultExposureTime(slitWidth, instrumentType, readoutMode){
return 60;
}

function arcDefaultExposureTime(instrumentType){
function arcDefaultExposureTime(instrumentType) {
if (isSoarInstrument(instrumentType)) {
return 0.5;
} else {
return 60;
}
}


function semesterStart(datetime){
if(datetime.month() < 3 ){
return datetime.subtract(1, 'years').month(9).date(1);
Expand Down

0 comments on commit b0295fa

Please sign in to comment.