From 4918b0bf5f74d35fbf3965dc84a874c71931f409 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Thu, 6 Jun 2019 17:06:23 -0400 Subject: [PATCH 01/18] Added FUVA LEFT monitor, changes to filesystem & monitor_helper --- cosmo/filesystem.py | 10 +++-- cosmo/monitor_helpers.py | 27 ++++++++---- cosmo/monitors/dark_data_models.py | 39 ++++++++++++++++++ cosmo/monitors/dark_monitors.py | 66 ++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 10 deletions(-) create mode 100644 cosmo/monitors/dark_data_models.py create mode 100644 cosmo/monitors/dark_monitors.py diff --git a/cosmo/filesystem.py b/cosmo/filesystem.py index a6f71902..9236ef30 100644 --- a/cosmo/filesystem.py +++ b/cosmo/filesystem.py @@ -90,13 +90,17 @@ def _define_spt_filename(self): def get_spt_header_data(self): with fits.open(self.spt_file) as spt: - self.data.update({key: spt[ext].header[key] for key, ext in zip(self.spt_keys, self.spt_exts)}) + for key, ext in zip(self.spt_keys, self.spt_exts): + self.data.update({key if key not in self.data else f'{key}_{ext}': spt[ext].header[key]}) def get_header_data(self): - self.data.update({key: self.hdu[ext].header[key] for key, ext in zip(self.header_keys, self.header_exts)}) + for key, ext in zip(self.header_keys, self.header_exts): + self.data.update({key if key not in self.data else f'{key}_{ext}': self.hdu[ext].header[key]}) def get_table_data(self): - self.data.update({key: self.hdu[ext].data[key] for key, ext in zip(self.data_keys, self.data_exts)}) + for key, ext in zip(self.data_keys, self.data_exts): + self.data.update({key if key not in self.data else f'{key}_{ext}': self.hdu[ext].data[key]}) + @dask.delayed diff --git a/cosmo/monitor_helpers.py b/cosmo/monitor_helpers.py index c6fb9c70..ed7a826c 100644 --- a/cosmo/monitor_helpers.py +++ b/cosmo/monitor_helpers.py @@ -46,15 +46,28 @@ def explode_df(df: pd.DataFrame, list_keywords: Union[list, tuple]) -> pd.DataFr return df1.join(df.drop(list_keywords, 1), how='left').reset_index(drop=True) -def compute_absolute_time(df: pd.DataFrame) -> Tuple[Time, Time]: +def compute_absolute_time(df: pd.DataFrame = None, expstart: float = None, time_array: Sequence = None) -> Tuple[Time, Time]: """Given a dataframe with EXPSTART keyword and a TIME column, compute the absolute time for the TIME column defined as EXPSTART + TIME[i] for each element, i in TIME. """ - if 'EXPSTART' not in df or 'TIME' not in df: - raise KeyError('To compute the absolute time, EXPSTART and TIME must be present in the dataframe.') + if df is not None and (expstart is not None or time_array is not None): + raise ValueError('Can only input a dataframe or arrays, not both') - start_time = Time(df.EXPSTART, format='mjd') - lamp_dt = TimeDelta(df.TIME, format='sec') - lamp_time = start_time + lamp_dt + if df is not None: + if 'EXPSTART' not in df or 'TIME' not in df: + raise KeyError('To compute the absolute time, EXPSTART and TIME must be present in the dataframe.') - return start_time, lamp_time + start_time = Time(df.EXPSTART, format='mjd') + time_dt = TimeDelta(df.TIME, format='sec') + absolute_time = start_time + time_dt + + return start_time, absolute_time + + if (expstart is not None and time_array is None) or (expstart is None and time_array is not None): + raise ValueError('Include both expstart and time_array') + + start_time = Time(expstart, format='mjd') + time_dt = TimeDelta(time_array, format='sec') + absolute_time = start_time + time_dt + + return start_time, absolute_time diff --git a/cosmo/monitors/dark_data_models.py b/cosmo/monitors/dark_data_models.py new file mode 100644 index 00000000..69260999 --- /dev/null +++ b/cosmo/monitors/dark_data_models.py @@ -0,0 +1,39 @@ +import pandas as pd +import os + +from monitorframe.monitor import BaseDataModel + +from cosmo.filesystem import FileDataFinder +from cosmo import FILES_SOURCE +from cosmo.monitor_helpers import explode_df + + +class DarkDataModel(BaseDataModel): + + def get_data(self): + header_keys = ( + 'ROOTNAME', 'EXPTIME', 'SEGMENT', 'EXPSTART' + ) + header_extensions = (0, 1, 0, 1) + + data_keys = ('TIME', 'LATITUDE', 'LONGITUDE', 'PHA', 'XCORR', 'YCORR', 'TIME') + data_extensions = ('timeline', 'timeline', 'timeline', 'events', 'events', 'events', 'events') + + results = [] + program_id = ['15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', '11895/'] + for prog_id in program_id: + print(prog_id) + new_files_source = os.path.join(FILES_SOURCE, prog_id) + finder = FileDataFinder( + new_files_source, + '*corrtag*', + header_keys, + header_extensions, + data_keys=data_keys, + data_extensions=data_extensions, + cosmo_layout=False + ) + results += finder.get_data_from_files() + df = pd.DataFrame(results) + + return df diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py new file mode 100644 index 00000000..188ee10c --- /dev/null +++ b/cosmo/monitors/dark_monitors.py @@ -0,0 +1,66 @@ +import numpy as np +import plotly.graph_objs as go +import pandas as pd + +from itertools import repeat + +from monitorframe import BaseMonitor +from .dark_data_models import DarkDataModel +from cosmo.monitor_helpers import fit_line, convert_day_of_year, explode_df, compute_absolute_time + + +def dark_filter(df_row, filter_pha, location): + good_pha = (2,23) + time_step = 25 + time_bins = df_row['TIME'][::time_step] + lat = df_row['LATITUDE'][::time_step][:-1] + lon = df_row['LONGITUDE'][::time_step][:-1] + event_df = df_row[['SEGMENT', 'XCORR', 'YCORR', 'PHA', 'TIME_events']].to_frame().T + event_df = explode_df(event_df, ['XCORR', 'YCORR', 'PHA', 'TIME_events']) + npix = (location[1] - location[0]) * (location[3] - location[2]) + index = np.where((event_df['SEGMENT'] == 'FUVA') & + (event_df['XCORR'] > location[0]) & + (event_df['XCORR'] < location[1]) & + (event_df['YCORR'] > location[2]) & + (event_df['YCORR'] < location[3])) + filtered_row = event_df.iloc[index].reset_index(drop=True) + + if filter_pha: + filtered_row = filtered_row[(filtered_row['PHA'] > good_pha[0]) & (filtered_row['PHA'] < good_pha[1])] + + counts = np.histogram(filtered_row.TIME_events, bins=time_bins)[0] + + _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) + date = mjd.to_datetime()[:-1] + dark_rate = counts / npix / time_step + + return pd.DataFrame({'segment': df_row['SEGMENT'], 'darks': [dark_rate], 'date': [date], + 'file': df_row['ROOTNAME'], 'hover_text': df_row['hover_text']}) + + +class FUVALeftDarkMonitor(BaseMonitor): + data_model = DarkDataModel + labels = ['ROOTNAME'] + output = '/Users/dashtamirova/Desktop/test_dark.html' + location = (1060, 1260, 296, 734) # + + def filter_data(self): + filtered_rows = [] + for _, row in self.data.iterrows(): + filtered_rows.append(dark_filter(row, True, self.location)) + filtered_df = pd.concat(filtered_rows).reset_index(drop=True) + + return explode_df(filtered_df, ['darks', 'date']) + + def define_plot(self): + self.plottype = 'scatter' + self.x = self.filtered_data.date + self.y = self.filtered_data.darks + + def store_results(self): + # TODO: Define results to store + pass + + def track(self): + # TODO: Define something to track + pass From df5666f5502b0491ca554a5021b1a935e7008559 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 10 Sep 2019 14:06:23 -0400 Subject: [PATCH 02/18] small changes to imports - doesn't work yet don't merge --- cosmo/monitors/dark_data_models.py | 12 +++++++----- cosmo/monitors/dark_monitors.py | 9 +++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cosmo/monitors/dark_data_models.py b/cosmo/monitors/dark_data_models.py index 69260999..dbdfbae9 100644 --- a/cosmo/monitors/dark_data_models.py +++ b/cosmo/monitors/dark_data_models.py @@ -1,11 +1,12 @@ import pandas as pd import os -from monitorframe.monitor import BaseDataModel +from monitorframe.datamodel import BaseDataModel -from cosmo.filesystem import FileDataFinder -from cosmo import FILES_SOURCE -from cosmo.monitor_helpers import explode_df +from ..filesystem import find_files, get_file_data +from .. import SETTINGS + +FILES_SOURCE = SETTINGS['filesystem']['source'] class DarkDataModel(BaseDataModel): @@ -23,7 +24,8 @@ def get_data(self): program_id = ['15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', '11895/'] for prog_id in program_id: print(prog_id) - new_files_source = os.path.join(FILES_SOURCE, prog_id) + new_files_source = os.patch.join(FILES_SOURCE, prog_id) + files = find_files('*corrtag*', data_dir=new_files_source, cosmo_layout=self.cosmo_layout) finder = FileDataFinder( new_files_source, '*corrtag*', diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 188ee10c..1a54a179 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -4,9 +4,9 @@ from itertools import repeat -from monitorframe import BaseMonitor +from monitorframe.monitor import BaseMonitor from .dark_data_models import DarkDataModel -from cosmo.monitor_helpers import fit_line, convert_day_of_year, explode_df, compute_absolute_time +from ..monitor_helpers import fit_line, convert_day_of_year, explode_df, ExposureAbsoluteTime def dark_filter(df_row, filter_pha, location): @@ -30,7 +30,8 @@ def dark_filter(df_row, filter_pha, location): counts = np.histogram(filtered_row.TIME_events, bins=time_bins)[0] - _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) + _, mjd = ExposureAbsoluteTime.compute_from_arrays(expstart=df_row['EXPSTART'], time_array=time_bins) + # _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) date = mjd.to_datetime()[:-1] dark_rate = counts / npix / time_step @@ -42,7 +43,7 @@ class FUVALeftDarkMonitor(BaseMonitor): data_model = DarkDataModel labels = ['ROOTNAME'] output = '/Users/dashtamirova/Desktop/test_dark.html' - location = (1060, 1260, 296, 734) # + location = (1060, 1260, 296, 734) # def filter_data(self): filtered_rows = [] From 4fcb7eebbb50437a8292e21143eb5a2654620398 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Wed, 25 Sep 2019 14:20:59 -0400 Subject: [PATCH 03/18] dark_data_models now works --- cosmo/filesystem.py | 8 +++++- cosmo/monitors/dark_data_models.py | 46 ++++++++++++++++++------------ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/cosmo/filesystem.py b/cosmo/filesystem.py index 3a418232..b1b4c1ac 100644 --- a/cosmo/filesystem.py +++ b/cosmo/filesystem.py @@ -106,7 +106,13 @@ def get_spt_header_data(self, spt_file, spt_keywords, spt_extensions): def get_table_data(self, hdu, data_keywords, data_extensions): """Get table data.""" - self.update({key: hdu[ext].data[key] for key, ext in zip(data_keywords, data_extensions)}) + table_data = {} + for key, ext in zip(data_keywords, data_extensions): + value = hdu[ext].data[key] + if key in table_data.keys(): + key = f'{key}_{ext}' + table_data[key] = value + self.update(table_data) def get_file_data(fitsfiles: List[str], keywords: Sequence, extensions: Sequence, spt_keywords: Sequence = None, diff --git a/cosmo/monitors/dark_data_models.py b/cosmo/monitors/dark_data_models.py index dbdfbae9..65ca61f1 100644 --- a/cosmo/monitors/dark_data_models.py +++ b/cosmo/monitors/dark_data_models.py @@ -10,8 +10,10 @@ class DarkDataModel(BaseDataModel): + cosmo_layout = False + program_id = ['15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', '11895/'] - def get_data(self): + def get_new_data(self): header_keys = ( 'ROOTNAME', 'EXPTIME', 'SEGMENT', 'EXPSTART' ) @@ -21,21 +23,27 @@ def get_data(self): data_extensions = ('timeline', 'timeline', 'timeline', 'events', 'events', 'events', 'events') results = [] - program_id = ['15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', '11895/'] - for prog_id in program_id: - print(prog_id) - new_files_source = os.patch.join(FILES_SOURCE, prog_id) - files = find_files('*corrtag*', data_dir=new_files_source, cosmo_layout=self.cosmo_layout) - finder = FileDataFinder( - new_files_source, - '*corrtag*', - header_keys, - header_extensions, - data_keys=data_keys, - data_extensions=data_extensions, - cosmo_layout=False - ) - results += finder.get_data_from_files() - df = pd.DataFrame(results) - - return df + + for prog_id in self.program_id: + + new_files_source = os.path.join(FILES_SOURCE, prog_id) + results += find_files('*corrtag*', data_dir=new_files_source, cosmo_layout=self.cosmo_layout) + + if self.model is not None: + currently_ingested = [item.FILENAME for item in self.model.select(self.model.FILENAME)] + + for file in currently_ingested: + results.remove(file) + + if not results: # No new files + return pd.DataFrame() + + file_data = get_file_data( + results, + header_keys, + header_extensions, + data_keywords=data_keys, + data_extensions=data_extensions + ) + + return file_data From c6fae096be952341b4f62292b1b60ed00a471667 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Thu, 3 Oct 2019 14:08:37 -0400 Subject: [PATCH 04/18] Merge branch 'master' of /Users/dashtamirova/cosmo with conflicts. --- cosmo/monitors/dark_monitors.py | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 cosmo/monitors/dark_monitors.py diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py new file mode 100644 index 00000000..ea1699a4 --- /dev/null +++ b/cosmo/monitors/dark_monitors.py @@ -0,0 +1,73 @@ +from typing import Any + +import numpy as np +import plotly.graph_objs as go +import pandas as pd + +from itertools import repeat + +from monitorframe.monitor import BaseMonitor +from .dark_data_models import DarkDataModel +from ..monitor_helpers import fit_line, convert_day_of_year, explode_df, absolute_time + + +def dark_filter(df_row, filter_pha, location): + good_pha = (2,23) + time_step = 25 + time_bins = df_row['TIME'][::time_step] + lat = df_row['LATITUDE'][::time_step][:-1] + lon = df_row['LONGITUDE'][::time_step][:-1] + event_df = df_row[['SEGMENT', 'XCORR', 'YCORR', 'PHA', 'TIME_events']].to_frame().T + event_df = explode_df(event_df, ['XCORR', 'YCORR', 'PHA', 'TIME_events']) + npix = (location[1] - location[0]) * (location[3] - location[2]) + index = np.where((event_df['SEGMENT'] == 'FUVA') & + (event_df['XCORR'] > location[0]) & + (event_df['XCORR'] < location[1]) & + (event_df['YCORR'] > location[2]) & + (event_df['YCORR'] < location[3])) + filtered_row = event_df.iloc[index].reset_index(drop=True) + + if filter_pha: + filtered_row = filtered_row[(filtered_row['PHA'] > good_pha[0]) & (filtered_row['PHA'] < good_pha[1])] + + counts = np.histogram(filtered_row.TIME_events, bins=time_bins)[0] + + _, mjd = absolute_time(expstart=df_row['EXPSTART'], time=time_bins) + # _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) + date = mjd.to_datetime()[:-1] + dark_rate = counts / npix / time_step + + return pd.DataFrame({'segment': df_row['SEGMENT'], 'darks': [dark_rate], 'date': [date], + 'file': df_row['ROOTNAME'], 'hover_text': df_row['hover_text']}) + + +def filter_data(self): + filtered_rows = [] + for _, row in self.data.iterrows(): + filtered_rows.append(dark_filter(row, True, self.location)) + filtered_df = pd.concat(filtered_rows).reset_index(drop=True) + + return explode_df(filtered_df, ['darks', 'date']) + + +class FUVALeftDarkMonitor(BaseMonitor): + data_model = DarkDataModel + labels = ['ROOTNAME'] + output = '/Users/dashtamirova/Desktop/test_dark.html' + location = (1060, 1260, 296, 734) + + def get_data(self) -> Any: + pass + + def plot(self): + self.plottype = 'scatter' + self.x = filter_data(self).date + self.y = filter_data(self).darks + + def store_results(self): + # TODO: Define results to store + pass + + def track(self): + # TODO: Define something to track + pass From af0a0e063b669a1009422d3542d5069f1460cd37 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Wed, 20 Nov 2019 14:43:43 -0500 Subject: [PATCH 05/18] add cy27 directory --- cosmo/monitors/dark_data_models.py | 3 ++- cosmo/monitors/dark_monitors.py | 38 ++++++++++++++---------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cosmo/monitors/dark_data_models.py b/cosmo/monitors/dark_data_models.py index 65ca61f1..e87b2a0f 100644 --- a/cosmo/monitors/dark_data_models.py +++ b/cosmo/monitors/dark_data_models.py @@ -11,7 +11,8 @@ class DarkDataModel(BaseDataModel): cosmo_layout = False - program_id = ['15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', '11895/'] + program_id = ['15771', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', + '11895/'] def get_new_data(self): header_keys = ( diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index ea1699a4..72980cee 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -12,7 +12,7 @@ def dark_filter(df_row, filter_pha, location): - good_pha = (2,23) + good_pha = (2, 23) time_step = 25 time_bins = df_row['TIME'][::time_step] lat = df_row['LATITUDE'][::time_step][:-1] @@ -32,37 +32,35 @@ def dark_filter(df_row, filter_pha, location): counts = np.histogram(filtered_row.TIME_events, bins=time_bins)[0] - _, mjd = absolute_time(expstart=df_row['EXPSTART'], time=time_bins) + date = absolute_time( + expstart=list(repeat(df_row['EXPSTART'], len(time_bins))), time=time_bins.tolist() + ).to_datetime()[:-1] # _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) - date = mjd.to_datetime()[:-1] dark_rate = counts / npix / time_step return pd.DataFrame({'segment': df_row['SEGMENT'], 'darks': [dark_rate], 'date': [date], - 'file': df_row['ROOTNAME'], 'hover_text': df_row['hover_text']}) - - -def filter_data(self): - filtered_rows = [] - for _, row in self.data.iterrows(): - filtered_rows.append(dark_filter(row, True, self.location)) - filtered_df = pd.concat(filtered_rows).reset_index(drop=True) - - return explode_df(filtered_df, ['darks', 'date']) + 'ROOTNAME': df_row['ROOTNAME']}) class FUVALeftDarkMonitor(BaseMonitor): + name = 'FUVA Dark Monitor - Left' data_model = DarkDataModel labels = ['ROOTNAME'] - output = '/Users/dashtamirova/Desktop/test_dark.html' + # output = add your own path location = (1060, 1260, 296, 734) + plottype = 'scatter' + x = 'date' + y = 'darks' def get_data(self) -> Any: - pass - - def plot(self): - self.plottype = 'scatter' - self.x = filter_data(self).date - self.y = filter_data(self).darks + filtered_rows = [] + for _, row in self.model.new_data.iterrows(): + if row.EXPSTART == 0: + continue + filtered_rows.append(dark_filter(row, True, self.location)) + filtered_df = pd.concat(filtered_rows).reset_index(drop=True) + + return explode_df(filtered_df, ['darks', 'date']) def store_results(self): # TODO: Define results to store From 95f750d675e8aeed67cac46086b1fa06a016d842 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Thu, 6 Feb 2020 16:24:14 -0500 Subject: [PATCH 06/18] draft that worked once upon a time --- cosmo/monitors/dark_monitors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 72980cee..bcfaa312 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -35,6 +35,7 @@ def dark_filter(df_row, filter_pha, location): date = absolute_time( expstart=list(repeat(df_row['EXPSTART'], len(time_bins))), time=time_bins.tolist() ).to_datetime()[:-1] + # _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) dark_rate = counts / npix / time_step @@ -46,7 +47,7 @@ class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' data_model = DarkDataModel labels = ['ROOTNAME'] - # output = add your own path + # output = enter_a_path location = (1060, 1260, 296, 734) plottype = 'scatter' x = 'date' From 95b14fba46072f6bca09369c457b39910b56bd2d Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Thu, 6 Feb 2020 16:47:36 -0500 Subject: [PATCH 07/18] draft that worked once upon a time --- cosmo/monitors/dark_data_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosmo/monitors/dark_data_models.py b/cosmo/monitors/dark_data_models.py index e87b2a0f..1ae824e8 100644 --- a/cosmo/monitors/dark_data_models.py +++ b/cosmo/monitors/dark_data_models.py @@ -28,7 +28,7 @@ def get_new_data(self): for prog_id in self.program_id: new_files_source = os.path.join(FILES_SOURCE, prog_id) - results += find_files('*corrtag*', data_dir=new_files_source, cosmo_layout=self.cosmo_layout) + results += find_files('*corrtag*', data_dir=new_files_source) if self.model is not None: currently_ingested = [item.FILENAME for item in self.model.select(self.model.FILENAME)] From c1ab365956cb4659f86096ff0bcacc8051a704a3 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Thu, 6 Feb 2020 16:48:38 -0500 Subject: [PATCH 08/18] draft for fuva left that worked once upon a time --- cosmo/monitors/dark_monitors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index bcfaa312..fd811a19 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -47,7 +47,7 @@ class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' data_model = DarkDataModel labels = ['ROOTNAME'] - # output = enter_a_path + # output = enter_a_path_here location = (1060, 1260, 296, 734) plottype = 'scatter' x = 'date' From 149178e7bd8c2dbc12b253b4e870453fafb346f6 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Thu, 6 Feb 2020 16:50:03 -0500 Subject: [PATCH 09/18] draft for fuva left that worked once upon a time --- cosmo/monitors/dark_monitors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index fd811a19..bcfaa312 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -47,7 +47,7 @@ class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' data_model = DarkDataModel labels = ['ROOTNAME'] - # output = enter_a_path_here + # output = enter_a_path location = (1060, 1260, 296, 734) plottype = 'scatter' x = 'date' From 67fb6bdb4fa33343dcd2358625d7f80fdcce3a2a Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Fri, 14 Feb 2020 14:51:20 -0500 Subject: [PATCH 10/18] DRAFT: updated and added darkdatamodel to datamodels --- cosmo/monitors/dark_data_models.py | 39 +++++++++++---------- cosmo/monitors/dark_monitors.py | 18 +++++----- cosmo/monitors/data_models.py | 56 ++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 28 deletions(-) diff --git a/cosmo/monitors/dark_data_models.py b/cosmo/monitors/dark_data_models.py index 1ae824e8..4edae6db 100644 --- a/cosmo/monitors/dark_data_models.py +++ b/cosmo/monitors/dark_data_models.py @@ -1,9 +1,9 @@ import pandas as pd import os - +from glob import glob from monitorframe.datamodel import BaseDataModel -from ..filesystem import find_files, get_file_data +from ..filesystem import find_files, data_from_exposures from .. import SETTINGS FILES_SOURCE = SETTINGS['filesystem']['source'] @@ -13,38 +13,39 @@ class DarkDataModel(BaseDataModel): cosmo_layout = False program_id = ['15771', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', '11895/'] + # subdir_pattern = '?????' def get_new_data(self): - header_keys = ( - 'ROOTNAME', 'EXPTIME', 'SEGMENT', 'EXPSTART' - ) - header_extensions = (0, 1, 0, 1) + header_request = { + 0: ['ROOTNAME', 'SEGMENT'], + 1: ['EXPTIME', 'EXPSTART'] + } - data_keys = ('TIME', 'LATITUDE', 'LONGITUDE', 'PHA', 'XCORR', 'YCORR', 'TIME') - data_extensions = ('timeline', 'timeline', 'timeline', 'events', 'events', 'events', 'events') + table_request = { + 1: ['PHA', 'XCORR', 'YCORR', 'TIME'], + 3: ['TIME', 'LATITUDE', 'LONGITUDE'] + } - results = [] + files = [] for prog_id in self.program_id: new_files_source = os.path.join(FILES_SOURCE, prog_id) - results += find_files('*corrtag*', data_dir=new_files_source) + files += find_files('*corrtag*', data_dir=new_files_source) if self.model is not None: currently_ingested = [item.FILENAME for item in self.model.select(self.model.FILENAME)] for file in currently_ingested: - results.remove(file) + files.remove(file) - if not results: # No new files + if not files: # No new files return pd.DataFrame() - file_data = get_file_data( - results, - header_keys, - header_extensions, - data_keywords=data_keys, - data_extensions=data_extensions + data_results = data_from_exposures( + files, + header_request=header_request, + table_request=table_request ) - return file_data + return data_results diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index bcfaa312..060607cb 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -7,18 +7,18 @@ from itertools import repeat from monitorframe.monitor import BaseMonitor -from .dark_data_models import DarkDataModel -from ..monitor_helpers import fit_line, convert_day_of_year, explode_df, absolute_time +from .data_models import FUVDarkDataModel +from ..monitor_helpers import explode_df, absolute_time def dark_filter(df_row, filter_pha, location): good_pha = (2, 23) time_step = 25 - time_bins = df_row['TIME'][::time_step] + time_bins = df_row['TIME_3'][::time_step] lat = df_row['LATITUDE'][::time_step][:-1] lon = df_row['LONGITUDE'][::time_step][:-1] - event_df = df_row[['SEGMENT', 'XCORR', 'YCORR', 'PHA', 'TIME_events']].to_frame().T - event_df = explode_df(event_df, ['XCORR', 'YCORR', 'PHA', 'TIME_events']) + event_df = df_row[['SEGMENT', 'XCORR', 'YCORR', 'PHA', 'TIME']].to_frame().T + event_df = explode_df(event_df, ['XCORR', 'YCORR', 'PHA', 'TIME']) npix = (location[1] - location[0]) * (location[3] - location[2]) index = np.where((event_df['SEGMENT'] == 'FUVA') & (event_df['XCORR'] > location[0]) & @@ -30,13 +30,12 @@ def dark_filter(df_row, filter_pha, location): if filter_pha: filtered_row = filtered_row[(filtered_row['PHA'] > good_pha[0]) & (filtered_row['PHA'] < good_pha[1])] - counts = np.histogram(filtered_row.TIME_events, bins=time_bins)[0] + counts = np.histogram(filtered_row.TIME, bins=time_bins)[0] date = absolute_time( expstart=list(repeat(df_row['EXPSTART'], len(time_bins))), time=time_bins.tolist() ).to_datetime()[:-1] - # _, mjd = compute_absolute_time(expstart=df_row['EXPSTART'], time_array=time_bins) dark_rate = counts / npix / time_step return pd.DataFrame({'segment': df_row['SEGMENT'], 'darks': [dark_rate], 'date': [date], @@ -45,9 +44,10 @@ def dark_filter(df_row, filter_pha, location): class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' - data_model = DarkDataModel + data_model = FUVDarkDataModel labels = ['ROOTNAME'] - # output = enter_a_path + # output = path to directory + location = (1060, 1260, 296, 734) plottype = 'scatter' x = 'date' diff --git a/cosmo/monitors/data_models.py b/cosmo/monitors/data_models.py index 503251ea..08cedaf6 100644 --- a/cosmo/monitors/data_models.py +++ b/cosmo/monitors/data_models.py @@ -1,5 +1,7 @@ import pandas as pd import numpy as np +import os +from glob import glob from typing import List from monitorframe.datamodel import BaseDataModel @@ -192,3 +194,57 @@ def get_new_data(self): data_results = data_results.replace([np.inf, -np.inf], np.nan).dropna().reset_index(drop=True) return data_results[~data_results.EXPTYPE.str.contains('ACQ|DARK|FLAT')] + + +class FUVDarkDataModel(BaseDataModel): + files_source = FILES_SOURCE + subdir_pattern = '?????' + cosmo_layout = False + + # program_id = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', + # '11895/'] + + primary_key = 'ROOTNAME' + + def get_new_data(self): + """Retrieve data""" + header_request = { + 0: ['ROOTNAME', 'SEGMENT'], + 1: ['EXPTIME', 'EXPSTART'] + } + + table_request = { + 1: ['PHA', 'XCORR', 'YCORR', 'TIME'], + 3: ['TIME', 'LATITUDE', 'LONGITUDE'] + } + """ + files = [] + + for prog_id in self.program_id: + + new_files_source = os.path.join(FILES_SOURCE, prog_id) + files += find_files('*corrtag*', data_dir=new_files_source, subdir_pattern=self.subdir_pattern) + + if self.model is not None: + currently_ingested = [item.FILENAME for item in self.model.select(self.model.FILENAME)] + + for file in currently_ingested: + files.remove(file) + """ + files = [] + program_ids = ['15771/'] + for program in program_ids: + new_files_source = os.path.join(FILES_SOURCE, program) + subfiles = glob(os.path.join(new_files_source, "*corrtag*")) + files += subfiles + + if not files: # No new files + return pd.DataFrame() + + data_results = data_from_exposures( + files, + header_request=header_request, + table_request=table_request + ) + + return data_results From 8935d219e85fd1fc581fef664f337b13d5541c04 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Fri, 14 Feb 2020 15:18:56 -0500 Subject: [PATCH 11/18] fixed the issue with dark counts clustering at zero --- cosmo/monitors/dark_monitors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 060607cb..b3ea87df 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -46,7 +46,7 @@ class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' data_model = FUVDarkDataModel labels = ['ROOTNAME'] - # output = path to directory + # output = add path location = (1060, 1260, 296, 734) plottype = 'scatter' @@ -58,7 +58,8 @@ def get_data(self) -> Any: for _, row in self.model.new_data.iterrows(): if row.EXPSTART == 0: continue - filtered_rows.append(dark_filter(row, True, self.location)) + if row.SEGMENT == 'FUVA': + filtered_rows.append(dark_filter(row, True, self.location)) filtered_df = pd.concat(filtered_rows).reset_index(drop=True) return explode_df(filtered_df, ['darks', 'date']) From 9f4c12cf3cac966b8944a28c6b16091422e4fbdd Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 10:59:04 -0500 Subject: [PATCH 12/18] updated subdir_pattern now find_files works --- cosmo/monitors/dark_monitors.py | 5 ++--- cosmo/monitors/data_models.py | 16 ++++------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index b3ea87df..4bdc8aa1 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -20,8 +20,7 @@ def dark_filter(df_row, filter_pha, location): event_df = df_row[['SEGMENT', 'XCORR', 'YCORR', 'PHA', 'TIME']].to_frame().T event_df = explode_df(event_df, ['XCORR', 'YCORR', 'PHA', 'TIME']) npix = (location[1] - location[0]) * (location[3] - location[2]) - index = np.where((event_df['SEGMENT'] == 'FUVA') & - (event_df['XCORR'] > location[0]) & + index = np.where((event_df['XCORR'] > location[0]) & (event_df['XCORR'] < location[1]) & (event_df['YCORR'] > location[2]) & (event_df['YCORR'] < location[3])) @@ -46,7 +45,7 @@ class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' data_model = FUVDarkDataModel labels = ['ROOTNAME'] - # output = add path + output = # path location = (1060, 1260, 296, 734) plottype = 'scatter' diff --git a/cosmo/monitors/data_models.py b/cosmo/monitors/data_models.py index 08cedaf6..de07234c 100644 --- a/cosmo/monitors/data_models.py +++ b/cosmo/monitors/data_models.py @@ -198,11 +198,10 @@ def get_new_data(self): class FUVDarkDataModel(BaseDataModel): files_source = FILES_SOURCE - subdir_pattern = '?????' cosmo_layout = False - # program_id = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', - # '11895/'] + program_id = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', + '11895/'] primary_key = 'ROOTNAME' @@ -217,26 +216,19 @@ def get_new_data(self): 1: ['PHA', 'XCORR', 'YCORR', 'TIME'], 3: ['TIME', 'LATITUDE', 'LONGITUDE'] } - """ + files = [] for prog_id in self.program_id: new_files_source = os.path.join(FILES_SOURCE, prog_id) - files += find_files('*corrtag*', data_dir=new_files_source, subdir_pattern=self.subdir_pattern) + files += find_files('*corrtag*', data_dir=new_files_source, subdir_pattern=None) if self.model is not None: currently_ingested = [item.FILENAME for item in self.model.select(self.model.FILENAME)] for file in currently_ingested: files.remove(file) - """ - files = [] - program_ids = ['15771/'] - for program in program_ids: - new_files_source = os.path.join(FILES_SOURCE, program) - subfiles = glob(os.path.join(new_files_source, "*corrtag*")) - files += subfiles if not files: # No new files return pd.DataFrame() From 17e66d67c1aa96e22cb7b743f36b294fc288bf11 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 11:17:38 -0500 Subject: [PATCH 13/18] added FUVA bottom monitor --- cosmo/monitors/dark_monitors.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 4bdc8aa1..26b4535c 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -70,3 +70,34 @@ def store_results(self): def track(self): # TODO: Define something to track pass + + +class FUVABottomDarkMonitor(BaseMonitor): + name = 'FUVA Dark Monitor - Bottom' + data_model = FUVDarkDataModel + labels = ['ROOTNAME'] + output = # path + + location = (1060, 15250, 296, 375) + plottype = 'scatter' + x = 'date' + y = 'darks' + + def get_data(self) -> Any: + filtered_rows = [] + for _, row in self.model.new_data.iterrows(): + if row.EXPSTART == 0: + continue + if row.SEGMENT == 'FUVA': + filtered_rows.append(dark_filter(row, True, self.location)) + filtered_df = pd.concat(filtered_rows).reset_index(drop=True) + + return explode_df(filtered_df, ['darks', 'date']) + + def store_results(self): + # TODO: Define results to store + pass + + def track(self): + # TODO: Define something to track + pass From 2e4abc094e70d3a66780d80abd584682cf2b7fc7 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 12:09:49 -0500 Subject: [PATCH 14/18] updated output location in yaml for myself --- cosmo/monitors/dark_monitors.py | 9 +++++++-- cosmo/monitors/data_models.py | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 26b4535c..ebe8092e 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -9,6 +9,9 @@ from monitorframe.monitor import BaseMonitor from .data_models import FUVDarkDataModel from ..monitor_helpers import explode_df, absolute_time +from .. import SETTINGS + +COS_MONITORING = SETTINGS['output'] def dark_filter(df_row, filter_pha, location): @@ -45,7 +48,7 @@ class FUVALeftDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Left' data_model = FUVDarkDataModel labels = ['ROOTNAME'] - output = # path + output = COS_MONITORING location = (1060, 1260, 296, 734) plottype = 'scatter' @@ -76,7 +79,7 @@ class FUVABottomDarkMonitor(BaseMonitor): name = 'FUVA Dark Monitor - Bottom' data_model = FUVDarkDataModel labels = ['ROOTNAME'] - output = # path + output = COS_MONITORING location = (1060, 15250, 296, 375) plottype = 'scatter' @@ -101,3 +104,5 @@ def store_results(self): def track(self): # TODO: Define something to track pass + + diff --git a/cosmo/monitors/data_models.py b/cosmo/monitors/data_models.py index de07234c..4f5f7d5c 100644 --- a/cosmo/monitors/data_models.py +++ b/cosmo/monitors/data_models.py @@ -200,8 +200,8 @@ class FUVDarkDataModel(BaseDataModel): files_source = FILES_SOURCE cosmo_layout = False - program_id = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', - '11895/'] + program_ids = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', + '11895/'] primary_key = 'ROOTNAME' @@ -219,7 +219,7 @@ def get_new_data(self): files = [] - for prog_id in self.program_id: + for prog_id in self.program_ids: new_files_source = os.path.join(FILES_SOURCE, prog_id) files += find_files('*corrtag*', data_dir=new_files_source, subdir_pattern=None) From b5a4c1563e2bb494d475fd250f41b129f2b1d7ad Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 12:29:15 -0500 Subject: [PATCH 15/18] added the rest of the FUV dark monitors --- cosmo/monitors/dark_monitors.py | 102 +++++++++++++++++++++++--------- cosmo/monitors/data_models.py | 5 +- 2 files changed, 77 insertions(+), 30 deletions(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index ebe8092e..d5d7beee 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -44,13 +44,12 @@ def dark_filter(df_row, filter_pha, location): 'ROOTNAME': df_row['ROOTNAME']}) -class FUVALeftDarkMonitor(BaseMonitor): - name = 'FUVA Dark Monitor - Left' - data_model = FUVDarkDataModel - labels = ['ROOTNAME'] +class FUVDarkMonitor(BaseMonitor): output = COS_MONITORING + segment = None + location = None - location = (1060, 1260, 296, 734) + labels = ['ROOTNAME'] plottype = 'scatter' x = 'date' y = 'darks' @@ -60,7 +59,7 @@ def get_data(self) -> Any: for _, row in self.model.new_data.iterrows(): if row.EXPSTART == 0: continue - if row.SEGMENT == 'FUVA': + if row.SEGMENT == self.segment: filtered_rows.append(dark_filter(row, True, self.location)) filtered_df = pd.concat(filtered_rows).reset_index(drop=True) @@ -75,34 +74,81 @@ def track(self): pass -class FUVABottomDarkMonitor(BaseMonitor): +class FUVABottomDarkMonitor(FUVDarkMonitor): + """FUVA dark monitor for bottom edge""" name = 'FUVA Dark Monitor - Bottom' data_model = FUVDarkDataModel - labels = ['ROOTNAME'] - output = COS_MONITORING - + segment = 'FUVA' location = (1060, 15250, 296, 375) - plottype = 'scatter' - x = 'date' - y = 'darks' - def get_data(self) -> Any: - filtered_rows = [] - for _, row in self.model.new_data.iterrows(): - if row.EXPSTART == 0: - continue - if row.SEGMENT == 'FUVA': - filtered_rows.append(dark_filter(row, True, self.location)) - filtered_df = pd.concat(filtered_rows).reset_index(drop=True) - return explode_df(filtered_df, ['darks', 'date']) +class FUVALeftDarkMonitor(FUVDarkMonitor): + """FUVA dark monitor for left edge""" + name = 'FUVA Dark Monitor - Left' + data_model = FUVDarkDataModel + segment = 'FUVA' + location = (1060, 1260, 296, 734) - def store_results(self): - # TODO: Define results to store - pass - def track(self): - # TODO: Define something to track - pass +class FUVATopDarkMonitor(FUVDarkMonitor): + """FUVA dark monitor for top edge""" + name = 'FUVA Dark Monitor - Top' + data_model = FUVDarkDataModel + segment = 'FUVA' + location = (1060, 15250, 660, 734) + + +class FUVARightDarkMonitor(FUVDarkMonitor): + """FUVA dark monitor for right edge""" + name = 'FUVA Dark Monitor - Right' + data_model = FUVDarkDataModel + segment = 'FUVA' + location = (15119, 15250, 296, 734) + + +class FUVAInnerDarkMonitor(FUVDarkMonitor): + """FUVA dark monitor for inner region""" + name = 'FUVA Dark Monitor - Inner' + data_model = FUVDarkDataModel + segment = 'FUVA' + location = (1260, 15119, 375, 660) + + +class FUVBBottomDarkMonitor(FUVDarkMonitor): + """FUVB dark monitor for bottom edge""" + name = 'FUVB Dark Monitor - Bottom' + data_model = FUVDarkDataModel + segment = 'FUVB' + location = (809, 15182, 360, 405) + + +class FUVBLeftDarkMonitor(FUVDarkMonitor): + """FUVB dark monitor for left edge""" + name = 'FUVB Dark Monitor - Left' + data_model = FUVDarkDataModel + segment = 'FUVB' + location = (809, 1000, 360, 785) + + +class FUVBTopDarkMonitor(FUVDarkMonitor): + """FUVB dark monitor for top edge""" + name = 'FUVB Dark Monitor - Top' + data_model = FUVDarkDataModel + segment = 'FUVB' + location = (809, 15182, 740, 785) + + +class FUVBRightDarkMonitor(FUVDarkMonitor): + """FUVB dark monitor for right edge""" + name = 'FUVB Dark Monitor - Right' + data_model = FUVDarkDataModel + segment = 'FUVB' + location = (14990, 15182, 360, 785) +class FUVBInnerDarkMonitor(FUVDarkMonitor): + """FUVB dark monitor for inner region""" + name = 'FUVB Dark Monitor - Inner' + data_model = FUVDarkDataModel + segment = 'FUVB' + location = (1000, 14990, 405, 740) diff --git a/cosmo/monitors/data_models.py b/cosmo/monitors/data_models.py index 4f5f7d5c..650754c5 100644 --- a/cosmo/monitors/data_models.py +++ b/cosmo/monitors/data_models.py @@ -200,8 +200,9 @@ class FUVDarkDataModel(BaseDataModel): files_source = FILES_SOURCE cosmo_layout = False - program_ids = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', - '11895/'] + """program_ids = ['15771/', '15533/', '14940/', '14520/', '14436/', '13968/', '13521/', '13121/', '12716/', '12423/', + '11895/']""" + program_ids = ['15771/', '15533/'] primary_key = 'ROOTNAME' From c2a05c45525b058c5cd48a4fa4d05119c2a62c56 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 12:56:46 -0500 Subject: [PATCH 16/18] added the rest of the FUV dark monitors --- cosmo/monitors/dark_monitors.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index d5d7beee..4d01a103 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -45,11 +45,13 @@ def dark_filter(df_row, filter_pha, location): class FUVDarkMonitor(BaseMonitor): + """Abstracted FUV Dark Monitor. Not meant to be used directly but rather inherited by specific segment and region + dark monitors""" + labels = ['ROOTNAME'] output = COS_MONITORING + docs = "https://spacetelescope.github.io/cosmo/monitors.html#fuv-dark-rate-monitors" segment = None location = None - - labels = ['ROOTNAME'] plottype = 'scatter' x = 'date' y = 'darks' @@ -76,10 +78,10 @@ def track(self): class FUVABottomDarkMonitor(FUVDarkMonitor): """FUVA dark monitor for bottom edge""" - name = 'FUVA Dark Monitor - Bottom' data_model = FUVDarkDataModel segment = 'FUVA' location = (1060, 15250, 296, 375) + name = f'FUVA Dark Monitor - Bottom' class FUVALeftDarkMonitor(FUVDarkMonitor): From c6242ed4789de8b147ede2a8a63d31bbea402c69 Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 12:57:33 -0500 Subject: [PATCH 17/18] updated some docstrings. all dark monitors work --- cosmo/monitors/dark_monitors.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 4d01a103..63cc3cdd 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -50,8 +50,10 @@ class FUVDarkMonitor(BaseMonitor): labels = ['ROOTNAME'] output = COS_MONITORING docs = "https://spacetelescope.github.io/cosmo/monitors.html#fuv-dark-rate-monitors" + segment = None location = None + plottype = 'scatter' x = 'date' y = 'darks' From 5f5ce5fd0f815155bd3ede23b3b0d9a11363306a Mon Sep 17 00:00:00 2001 From: Dzhuliya Dashtamirova Date: Tue, 18 Feb 2020 12:58:58 -0500 Subject: [PATCH 18/18] working monitors yay --- cosmo/monitors/dark_monitors.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/cosmo/monitors/dark_monitors.py b/cosmo/monitors/dark_monitors.py index 63cc3cdd..4d01a103 100644 --- a/cosmo/monitors/dark_monitors.py +++ b/cosmo/monitors/dark_monitors.py @@ -50,10 +50,8 @@ class FUVDarkMonitor(BaseMonitor): labels = ['ROOTNAME'] output = COS_MONITORING docs = "https://spacetelescope.github.io/cosmo/monitors.html#fuv-dark-rate-monitors" - segment = None location = None - plottype = 'scatter' x = 'date' y = 'darks'