Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

39 add fuv dark monitors #73

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4918b0b
Added FUVA LEFT monitor, changes to filesystem & monitor_helper
dzhuliya Jun 6, 2019
5a7acde
Merge branch '46-add-tests' into 39-add-fuv-dark-monitors
dzhuliya Jun 12, 2019
e906982
Merge remote-tracking branch 'origin/master' into 39-add-fuv-dark-mon…
dzhuliya Aug 29, 2019
df5666f
small changes to imports - doesn't work yet don't merge
dzhuliya Sep 10, 2019
f58151d
Merge branch 'master' into 39-add-fuv-dark-monitors
dzhuliya Sep 10, 2019
4fcb7ee
dark_data_models now works
dzhuliya Sep 25, 2019
c6fae09
Merge branch 'master' of /Users/dashtamirova/cosmo with conflicts.
dzhuliya Oct 3, 2019
3324df1
Merge branch 'master' into 39-add-fuv-dark-monitors
dzhuliya Oct 3, 2019
af0a0e0
add cy27 directory
dzhuliya Nov 20, 2019
95f750d
draft that worked once upon a time
dzhuliya Feb 6, 2020
0d65787
Merge remote-tracking branch 'origin/master'
dzhuliya Feb 6, 2020
2fd7265
Merge branch 'master' into 39-add-fuv-dark-monitors
dzhuliya Feb 6, 2020
95b14fb
draft that worked once upon a time
dzhuliya Feb 6, 2020
c1ab365
draft for fuva left that worked once upon a time
dzhuliya Feb 6, 2020
149178e
draft for fuva left that worked once upon a time
dzhuliya Feb 6, 2020
67fb6bd
DRAFT: updated and added darkdatamodel to datamodels
dzhuliya Feb 14, 2020
8935d21
fixed the issue with dark counts clustering at zero
dzhuliya Feb 14, 2020
9f4c12c
updated subdir_pattern now find_files works
dzhuliya Feb 18, 2020
17e66d6
added FUVA bottom monitor
dzhuliya Feb 18, 2020
7a011e6
Merge remote-tracking branch 'origin/master'
dzhuliya Feb 18, 2020
49b9a16
Merge branch 'master' into 39-add-fuv-dark-monitors
dzhuliya Feb 18, 2020
2e4abc0
updated output location in yaml for myself
dzhuliya Feb 18, 2020
b5a4c15
added the rest of the FUV dark monitors
dzhuliya Feb 18, 2020
c2a05c4
added the rest of the FUV dark monitors
dzhuliya Feb 18, 2020
c6242ed
updated some docstrings. all dark monitors work
dzhuliya Feb 18, 2020
5f5ce5f
working monitors yay
dzhuliya Feb 18, 2020
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
36 changes: 33 additions & 3 deletions cosmo/monitors/dark_monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand All @@ -46,7 +45,7 @@ class FUVALeftDarkMonitor(BaseMonitor):
name = 'FUVA Dark Monitor - Left'
data_model = FUVDarkDataModel
labels = ['ROOTNAME']
# output = add path
output = # path
dzhuliya marked this conversation as resolved.
Show resolved Hide resolved

location = (1060, 1260, 296, 734)
plottype = 'scatter'
Expand All @@ -71,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
16 changes: 4 additions & 12 deletions cosmo/monitors/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
dzhuliya marked this conversation as resolved.
Show resolved Hide resolved
'11895/']

primary_key = 'ROOTNAME'

Expand All @@ -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()
Expand Down