diff --git a/config.py b/config.py index 895833ab0..63cbcbd9b 100644 --- a/config.py +++ b/config.py @@ -34,7 +34,9 @@ try: site_name = hostname_file[0].split("hostname")[1] - # print( + if '.' in site_name: + split_site=site_name.split('.') + site_name = split_site[0]# print( # "Adding new config path: " # + str(os.path.join(pathlib.Path().resolve(), "configs", site_name)) # ) diff --git a/configs/aro/site_config.py b/configs/aro1/site_config.py similarity index 90% rename from configs/aro/site_config.py rename to configs/aro1/site_config.py index 43819c821..5381fa0f2 100644 --- a/configs/aro/site_config.py +++ b/configs/aro1/site_config.py @@ -86,8 +86,8 @@ 'mpc_code': 'ZZ24', # This is made up for now. 'time_offset': -6.0, # These two keys may be obsolete give the new TZ stuff 'timezone': 'MDT', # This was meant to be coloquial Time zone abbreviation, alternate for "TX_data..." - 'latitude': 35.554298, # Decimal degrees, North is Positive - 'longitude': -105.870197, # Decimal degrees, West is negative + 'latitude': 35.554298, # ARo 35d33m15.472s Decimal degrees, North is Positive + 'longitude': -105.870197, #ARO -105d52m12.7092s Decimal degrees, West is negative 'elevation': 2194, # meters above sea level 'reference_ambient': 10.0, # Degrees Celsius. Alternately 12 entries, one for every - mid month. 'reference_pressure': 794.0, #mbar A rough guess 20200315 @@ -290,7 +290,7 @@ #'telescop': 'cvagr-0m30-f9-f4p9-001', 'ptrtel': 'cvagr-0m30-f9-f4p9-001', 'driver': None, # Essentially this device is informational. It is mostly about the optics. - 'collecting_area': 31808, + 'collecting_area': 31808, #This is correct as of 20230420 WER 'obscuration': 0.55, # Informatinal, already included in collecting_area. 'aperture': 30, 'focal_length': 1470, # 1470, #2697, # Converted to F9, measured 20200905 11.1C @@ -427,12 +427,16 @@ "driver": "LCO.dual", # 'ASCOM.FLI.FilterWheel', #'MAXIM', 'ip_string': 'http://10.0.0.110', "dual_wheel": True, + 'filter_reference': 'w', 'settings': { 'filter_count': 43, + "filter_type": "50mm_sq.", + "filter_manuf": "Astrodon", 'home_filter': 1, 'default_filter': "w", 'filter_reference': 1, # We choose to use W as the default filter. Gains taken at F9, Ceravolo 300mm # Columns for filter data are : ['filter', 'filter_index', 'filter_offset', 'sky_gain', 'screen_gain', 'alias'] + #NB NB Note to WER please add cwl, bw and 'shape' 'filter_data': [ ['air', [0, 0], -800, 81.6, [2 , 20], 'ai'], # 0. Gains 20211020 Clear NE sky ['focus',[7, 0], 0, 72.8, [360 , 170], 'w '], # 1. @@ -465,18 +469,18 @@ ['CR', [0, 5], 0, .556, [360 , 170], 'Rc'], #28. ['dark', [5, 6], 0, 0.20, [360 , 170], 'dk'], #29. ['dif', [0, 1], 0, 75.0, [360 , 170], 'df'], #30. #NONE OF THESE OR BELOW have accurate gains. - ['difw', [7, 1], 0, 72.6, [0.65, 20], 'dw'], #31. - ['difup', [1, 1], 0, 10.5, [0.65, 20], 'du'], #31. - ['difgp', [2, 1], 0, 234, [0.65, 20], 'dg'], #33. - ['difrp', [3, 1], 0, 70.0, [0.65, 20], 'dr'], #34. - ['difip', [4, 1], 0, 150., [0.65, 20], 'di'], #35. - ['difz', [5, 1], 0, 0.73, [0.65, 20], 'ds'], #35. - ['dify', [6, 1], 0, 0.15, [0.65, 20], 'dY'], #37. - ['difEXO', [8, 1], 0, 161., [0.65, 20], 'dx'], #38. - ['difJB', [9, 1], 0, 42.5, [0.65, 20], 'dB'], #39. - ['difJV', [10, 1], 0, 33.0, [0.65, 20], 'dV'], #40. - ['difRc', [11, 1], 0, 22.2, [0.65, 20], 'dR'], #41. - ['difIc', [12, 1], 0, 10. , [0.65, 20], 'dI']], #42. + ['difw', [7, 1], 0, 72.6, [0.65, 20], 'dw'], #31. + ['difup',[1, 1], 0, 10.5, [0.65, 20], 'du'], #31. + ['difgp',[2, 1], 0, 234, [0.65, 20], 'dg'], #33. + ['difrp',[3, 1], 0, 70.0, [0.65, 20], 'dr'], #34. + ['difip',[4, 1], 0, 150., [0.65, 20], 'di'], #35. + ['difz', [5, 1], 0, 0.73, [0.65, 20], 'ds'], #35. + ['dify', [6, 1], 0, 0.15, [0.65, 20], 'dY'], #37. + ['difEXO',[8, 1], 0, 161., [0.65, 20], 'dx'], #38. + ['difJB',[9, 1], 0, 42.5, [0.65, 20], 'dB'], #39. + ['difJV',[10, 1], 0, 33.0, [0.65, 20], 'dV'], #40. + ['difRc',[11, 1], 0, 22.2, [0.65, 20], 'dR'], #41. + ['difIc',[12, 1], 0, 10. , [0.65, 20], 'dI']], #42. 'filter_screen_sort': [12, 0, 11, 2, 3, 5, 4, 1, 6], # don't use narrow yet, 8, 10, 9], useless to try. @@ -511,7 +515,7 @@ 'name': 'sq002ms', # Important because this points to a server file structure by that name. 'desc': 'QHY 600Pro', 'service_date': '20211111', - 'driver': "ASCOM.QHYCCD_CAM2.Camera", #"Maxim.CCDCamera", # "ASCOM.QHYCCD.Camera", ## 'ASCOM.FLI.Kepler.Camera', + 'driver': "ASCOM.QHYCCD.Camera", #"Maxim.CCDCamera", # "ASCOM.QHYCCD.Camera", ## 'ASCOM.FLI.Kepler.Camera', 'detector': 'Sony IMX455', 'manufacturer': 'QHY', 'use_file_mode': False, @@ -522,7 +526,26 @@ 'is_osc' : False, 'transpose_fits' : False, + 'flipx_fits': False, + 'flipy_fits': False, + 'rotate90_fits': False, + 'rotate180_fits': False, + 'rotate270_fits': False, 'transpose_jpeg' : True, + 'squash_on_x_axis': False, + 'flipx_jpeg': False, + 'flipy_jpeg': False, + 'rotate90_jpeg': False, + 'rotate180_jpeg': False, + 'rotate270_jpeg': False, + 'reduced_image_edge_crop': 30, + 'focus_image_crop_width': 0.0, + 'focus_image_crop_height': 0.0, + 'focus_jpeg_size': 1500, + 'platesolve_image_crop': 0.0, + 'sep_image_crop_width': 0.0, + 'sep_image_crop_Height': 0.0, + 'do_cosmics': False, 'osc_bayer' : 'RGGB', 'crop_preview': False, 'crop_preview_ybottom': 1, @@ -530,7 +553,7 @@ 'crop_preview_xleft': 1, 'crop_preview_xright': 1, 'temp_setpoint': -12.5, - 'calib_setpoints': [-12.5, -10, -7.5, -5], # Should vary with season? by day-of-year mod len(list) + 'calib_setpoints': [-7.5, -5, 0], # Should vary with season? by day-of-year mod len(list) 'day_warm': False, 'cooler_on': True, 'x_start': 0, @@ -575,20 +598,20 @@ 'cosmics_at_default' : 'yes', 'cosmics_at_maximum' : 'yes', - 'cycle_time': [18, 15, 15, 12], # 3x3 requires a 1, 1 reaout then a software bin, so slower. + 'cycle_time': 18, # 3x3 requires a 1, 1 reaout then a software bin, so slower. 'rbi_delay': 0., # This being zero says RBI is not available, eg. for SBIG. 'is_cmos': True, 'is_color': False, 'can_set_gain': False, 'bayer_pattern': None, # Need to verify R as in RGGB is pixel x=0, y=0, B is x=1, y = 1 - 'reference_gain': [1.3, 2.6, 3.9, 5.2], #One val for each binning. - 'reference_noise': [6, 6, 6, 6], # NB Guess - 'reference_dark': [.2, .8, 1.8, 3.2], # Guess + 'reference_gain': 1.3,# 3 2.6, 3.9, 5.2], #One val for each binning. + 'reference_noise': 1.5, # 6, 6, 6], # NB Guess + 'reference_dark': 0.1, #, .8, 1.8, 3.2], # Guess 'ref_dark': 360.0, # this needs fixing. 'long_dark':600.0, 'max_linearity': 60000, # Guess 60% of this is max counts for skyflats. 75% rejects the skyflat - 'saturate': [[1, 65000], [2,262000], [3,589815], [4, 1048560]] , # e-. This is a close guess, not measured, but taken from data sheet. - 'fullwell_capacity': [80000, 320000, 720000, 1280000], + 'saturate': 60000, # [2,262000], [3,589815], [4, 1048560]] , # e-. This is a close guess, not measured, but taken from data sheet. + 'fullwell_capacity': 80000, # 320000, 720000, 1280000], #hdu.header['RDMODE'] = (self.config['camera'][self.name]['settings']['read_mode'], 'Camera read mode') #hdu.header['RDOUTM'] = (self.config['camera'][self.name]['readout_mode'], 'Camera readout mode') #hdu.header['RDOUTSP'] = (self.config['camera'][self.name]['settings']['readout_speed'], '[FPS] Readout speed') @@ -600,10 +623,11 @@ 'areas_implemented': ["Full", '2x2', '4x4',"600%", "500%", "450%", "300%", "220%", "150%", "133%", "100%", "Sqr", '71%', '50%', '35%', '25%', '12%'], 'default_area': "Full", 'has_darkslide': True, + 'darkslide_com': 'COM10', 'shutter_type': "Electronic", - 'flat_bin_spec': ['1,1','2,2'], #Default binning for flats - 'bias_dark_bin_spec': ['1,1','2,2'], #Default binning for flats - 'bin_enable': ['1,1', '2,2'], + 'flat_bin_spec': '1,1', #'2,2'], #Default binning for flats + 'bias_dark_bin_spec': '1,1', #'2,2'], #Default binning for flats + 'bin_enable': '1,1', #'2,2'], 'dark_length' : 900, 'bias_count' : 10, 'dark_count' : 10, @@ -611,7 +635,6 @@ 'optimal_bin': [2, 2, 0.575], 'max_res_bin': [1, 1, 0.2876], 'pix_scale': [0.2876, 0.575, 0.863, 1.15], # 1.4506, bin-2 2* math.degrees(math.atan(9/3962000))*3600 - 'darkslide_com': 'COM17', 'has_screen': True, 'screen_settings': { 'screen_saturation': 157.0, # This reflects WMD setting and needs proper values. diff --git a/devices/camera.py b/devices/camera.py index 1676ab7dd..0f7f18ee3 100644 --- a/devices/camera.py +++ b/devices/camera.py @@ -462,7 +462,7 @@ def __init__(self, driver: str, name: str, config: dict): self.hint = None self.focus_cache = None - self.darkslide = False + self.darkslide_state = "N.A." #Not Available. if self.config["camera"][self.name]["settings"]["has_darkslide"]: self.darkslide = True @@ -761,6 +761,7 @@ def parse_command(self, command): if self.user_name != self.last_user_name: self.last_user_name = self.user_name if action == "expose" and not self.exposure_busy: + self.expose_command(req, opt, do_sep=True, quick=False) self.exposure_busy = False # Hangup needs to be guarded with a timeout. self.active_script = None @@ -848,6 +849,7 @@ def expose_command( # Force a reseek //eventually dither// + # nb nb nb THIS FAULTS SELF.T0 IS NOT DEFINED try: if ( g_dev["mnt"].last_seek_time < self.t0 - 180 @@ -1497,7 +1499,7 @@ def finish_exposure( #plog("no ocn") try: - + if self.config["camera"][self.name]["settings"]["transpose_fits"]: hdu = fits.PrimaryHDU( self.img.transpose().astype('float32')) diff --git a/devices/filter_wheel.py b/devices/filter_wheel.py index b25325010..fabc036ef 100644 --- a/devices/filter_wheel.py +++ b/devices/filter_wheel.py @@ -35,9 +35,9 @@ def __init__(self, driver, name: str, config: dict): self.filter_screen_sort = self.config["filter_wheel1"]["settings"][ "filter_screen_sort" ] - #self.filter_reference = int( - # self.config["filter_wheel1"]["settings"]["filter_reference"] - #) + self.filter_reference = int( + self.config["filter_wheel1"]["settings"]["filter_reference"] + ) # NOTE: THIS CODE DOES NOT implement a filter via the Maxim application # which is passed in as a valid instance of class camera. diff --git a/devices/focuser.py b/devices/focuser.py index 0a45d685a..437d1fcf4 100644 --- a/devices/focuser.py +++ b/devices/focuser.py @@ -60,10 +60,12 @@ def __init__(self, driver: str, name: str, config: dict): "Focuser connected, at: ", round(self.focuser.Position * self.steps_to_micron, 1), ) + self.reference = None self.last_known_focus = None self.last_temperature = None self.last_source = None + self.time_of_last_focus = datetime.datetime.now() - datetime.timedelta( days=1 ) # Initialise last focus as yesterday @@ -148,6 +150,7 @@ def calculate_compensation(self, temp_primary): return float(self.config["reference"]) def get_status(self): + try: if g_dev['fil'].null_filterwheel == False: status = { @@ -174,7 +177,6 @@ def get_status(self): print ("usually the focusser program has crashed. This breakpoint is to help catch and code in a fix - MTF") print ("possibly just institute a full reboot") print (traceback.format_exc()) - breakpoint() # except: diff --git a/obs.py b/obs.py index 04223a25a..53ab60061 100644 --- a/obs.py +++ b/obs.py @@ -1,5 +1,4 @@ -\ - """" +""" IMPORTANT TODOs: WER 20211211 @@ -368,6 +367,7 @@ def create_devices(self): elif dev_type == "enclosure": device = Enclosure(driver, name, self.config, self.astro_events) elif dev_type == "mount": + device = Mount( driver, name, settings, self.config, self.astro_events, tel=True ) # NB this needs to be straightened out. @@ -380,6 +380,7 @@ def create_devices(self): elif dev_type == "screen": device = Screen(driver, name, self.config) elif dev_type == "filter_wheel": + device = FilterWheel(driver, name, self.config) elif dev_type == "selector": device = Selector(driver, name, self.config) @@ -837,7 +838,7 @@ def update(self): # Also an area to put things to irregularly check if things are still connected, e.g. cooler # # Probably we don't want to run these checkes EVERY status update, just every 5 minutes - if time.time() - self.time_since_safety_checks > 300: + if False and ( time.time() - self.time_since_safety_checks > 300): self.time_since_safety_checks=time.time() #breakpoint() @@ -847,8 +848,10 @@ def update(self): # Opening and Shutting should be done more glamorously through the # sequencer, but if all else fails, this routine should save # the observatory from rain, wasps and acts of god. - print ("Roof Status: " + str(g_dev['enc'].status['shutter_status'])) - + try: + print ("Roof Status: " + str(g_dev['enc'].status['shutter_status'])) + except: + plog("ARO not reporting roof sataus in obs line 854") if g_dev['enc'].status['shutter_status'] == 'Software Fault': print ("Software Fault Detected. Will alert the authorities!") diff --git a/requirements.txt b/requirements.txt index 2b5152c12..7963e2d23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,6 +34,7 @@ ocs-ingester Pillow==9.2.0 pycparser==2.21 pycryptodome +pyowm pyparsing==3.0.9 python-dateutil==2.8.2 python-dotenv==0.21.0