diff --git a/src/simmer/drivers.py b/src/simmer/drivers.py index d091ec05..d30c24d3 100644 --- a/src/simmer/drivers.py +++ b/src/simmer/drivers.py @@ -98,14 +98,6 @@ def all_driver( """ - # get file list from config file - config = pd.read_csv(config_file) - config.Object = config.Object.astype(str) - - darks.dark_driver(raw_dir, reddir, config, inst) - flats.flat_driver(raw_dir, reddir, config, inst) - sky.sky_driver(raw_dir, reddir, config, inst) - def image_driver(inst, config_file, raw_dir, reddir): """ diff --git a/src/simmer/run_night.py b/src/simmer/run_night.py index d0204acb..07cdd2a5 100644 --- a/src/simmer/run_night.py +++ b/src/simmer/run_night.py @@ -59,5 +59,6 @@ def run_night(wantdate, add_darks=True, just_images=False, verbose=False, skip_r #Reduce the data! if skip_reduction == True: print('files exist') + return config_file else: drivers.all_driver(inst, config_file, rawdir, reddir, just_images=just_images) diff --git a/src/simmer/validate_config.py b/src/simmer/validate_config.py index 0ae3c4de..29414e87 100644 --- a/src/simmer/validate_config.py +++ b/src/simmer/validate_config.py @@ -15,8 +15,9 @@ from . import utils as u -def validate_config(config, raw_dir, inst): - print('inspecting directory: ', raw_dir) +def validate_config(config, raw_dir, inst, verbose=False): + if verbose == True: + print('inspecting directory: ', raw_dir) objissues = 0 expissues = 0 @@ -29,49 +30,70 @@ def validate_config(config, raw_dir, inst): for file in flist: head = pyfits.getheader(file) hkeys = np.array(list(head.keys())) - print(' ', os.path.basename(file), head['Object'], head['RA'], head['DEC']) + if verbose == True: + print(' ', os.path.basename(file), head['Object'], head['RA'], head['DEC']) - if (this.Object.casefold() != head['Object'].casefold()): - print('ISSUE! ', os.path.basename(file)) - print(' Object mismatch') - print(' Object in header: ', head['Object']) - print(' Object in logsheet: ', this.Object) - print(' Pointing RA: ', head['RA']) - print(' Pointing Dec ', head['DEC']) - print('**************************') + #Check object for everything but flats + if np.logical_and(this.Object.casefold() != head['Object'].casefold(), this.Object.casefold() != 'flat'): + if verbose == True: + print('ISSUE! ', os.path.basename(file)) + print(' Object mismatch') + print(' Object in header: ', head['Object']) + print(' Object in logsheet: ', this.Object) + print(' Pointing RA: ', head['RA']) + print(' Pointing Dec ', head['DEC']) + print('**************************') objissues += 1 + #check object for flats + if this.Object.casefold() == 'flat': + if np.logical_and(np.logical_and(head['Object'].casefold() != 'flat',head['Object'].casefold() != 'flats'), np.logical_and(head['Object'].casefold().replace(" ","") != 'skyflat',head['Object'].casefold().replace(" ","") != 'domeflat')): + if verbose == True: + print('ISSUE! ', os.path.basename(file)) + print(' Object mismatch') + print(' Object in header: ', head['Object']) + print(' Object in logsheet: ', this.Object) + print(' Pointing RA: ', head['RA']) + print(' Pointing Dec ', head['DEC']) + print('**************************') + objissues += 1 + #Compare exposure times. ITIME0 is recorded in microseconds if (this.ExpTime != (head['ITIME0']/1e6)): - print('ISSUE! ', os.path.basename(file)) - print(' ExpTime mismatch') - print(' ExpTime in header: ', head['ITIME0']/1e6) - print(' ExpTime in logsheet: ', this.ExpTime) - print('**************************') - expissues += 1 - - #Check filters for everything but darks - if this.Object != "dark": - if np.logical_and(this.Filter != head['FILT1NAM'], this.Filter != 'J+Ch4-1.2'): + if verbose == True: print('ISSUE! ', os.path.basename(file)) - print(' Filter mismatch') - print(' Filters in header: ', head['FILT1NAM'],head['FILT2NAM']) - print(' Filter in logsheet: ', this.Filter) + print(' ExpTime mismatch') + print(' ExpTime in header: ', head['ITIME0']/1e6) + print(' ExpTime in logsheet: ', this.ExpTime) print('**************************') - filtissues += 1 + expissues += 1 - #Check filters for J+Ch1.4 - if this.Filter == 'J+Ch4-1.2': - if np.logical_or(head['FILT1NAM'] != 'J', head['FILT2NAM'] != 'Ch4-1.2'): + #Check filters for everything but darks & J+Ch4-1.2 images + if this.Object != "dark": + if np.logical_and(this.Filter != head['FILT1NAM'], this.Filter.casefold().replace(" ","") != 'J+Ch4-1.2'.casefold()): + if verbose == True: print('ISSUE! ', os.path.basename(file)) print(' Filter mismatch') print(' Filters in header: ', head['FILT1NAM'],head['FILT2NAM']) print(' Filter in logsheet: ', this.Filter) print('**************************') + filtissues += 1 + + #Check filters for J+Ch1.4 + if this.Filter.casefold().replace(" ","") == 'J+Ch4-1.2': + if np.logical_or(head['FILT1NAM'] != 'J', head['FILT2NAM'] != 'Ch4-1.2'): + if verbose == True: + print('ISSUE! ', os.path.basename(file)) + print(' Filter mismatch') + print(' Filters in header: ', head['FILT1NAM'],head['FILT2NAM']) + print(' Filter in logsheet: ', this.Filter) + print('**************************') filtissues += 1 + #always print the final summary print('#################################') print('SUMMARY') print('Object mismatches: ', objissues) print('Exptime mismatches: ', expissues) print('Filter mismatches: ', filtissues) + print('#################################')