Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/simmer/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
1 change: 1 addition & 0 deletions src/simmer/run_night.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
78 changes: 50 additions & 28 deletions src/simmer/validate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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('#################################')
Loading