From 9b544ac90166c6517cf18a1026862a9d4b07f65c Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 14:44:08 -0500 Subject: [PATCH 01/16] Update monitors tables so that they are now part of the jwql app, but are distinguished in terms of database by meta.db_table_comment --- .../apps/jwql/monitor_models/bad_pixel.py | 20 ++++---- jwql/website/apps/jwql/monitor_models/bias.py | 12 ++--- jwql/website/apps/jwql/monitor_models/claw.py | 4 +- .../apps/jwql/monitor_models/common.py | 34 ++++++------- .../apps/jwql/monitor_models/cosmic_ray.py | 20 ++++---- .../apps/jwql/monitor_models/dark_current.py | 30 +++++------ jwql/website/apps/jwql/monitor_models/edb.py | 50 +++++++++---------- .../apps/jwql/monitor_models/grating.py | 4 +- .../apps/jwql/monitor_models/readnoise.py | 20 ++++---- jwql/website/apps/jwql/monitor_models/ta.py | 8 +-- 10 files changed, 101 insertions(+), 101 deletions(-) diff --git a/jwql/website/apps/jwql/monitor_models/bad_pixel.py b/jwql/website/apps/jwql/monitor_models/bad_pixel.py index 151aa39ff..7e53e8a78 100644 --- a/jwql/website/apps/jwql/monitor_models/bad_pixel.py +++ b/jwql/website/apps/jwql/monitor_models/bad_pixel.py @@ -48,7 +48,7 @@ class Meta: managed = True db_table = 'fgs_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSBadPixelStats(models.Model): @@ -67,7 +67,7 @@ class Meta: managed = True db_table = 'fgs_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIBadPixelQueryHistory(models.Model): @@ -88,7 +88,7 @@ class Meta: managed = True db_table = 'miri_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIBadPixelStats(models.Model): @@ -107,7 +107,7 @@ class Meta: managed = True db_table = 'miri_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamBadPixelQueryHistory(models.Model): @@ -128,7 +128,7 @@ class Meta: managed = True db_table = 'nircam_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamBadPixelStats(models.Model): @@ -147,7 +147,7 @@ class Meta: managed = True db_table = 'nircam_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSBadPixelQueryHistory(models.Model): @@ -168,7 +168,7 @@ class Meta: managed = True db_table = 'niriss_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSBadPixelStats(models.Model): @@ -187,7 +187,7 @@ class Meta: managed = True db_table = 'niriss_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecBadPixelQueryHistory(models.Model): @@ -208,7 +208,7 @@ class Meta: managed = True db_table = 'nirspec_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecBadPixelStats(models.Model): @@ -227,4 +227,4 @@ class Meta: managed = True db_table = 'nirspec_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/bias.py b/jwql/website/apps/jwql/monitor_models/bias.py index 306ef3b29..e280c44d9 100644 --- a/jwql/website/apps/jwql/monitor_models/bias.py +++ b/jwql/website/apps/jwql/monitor_models/bias.py @@ -44,7 +44,7 @@ class Meta: managed = True db_table = 'nircam_bias_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamBiasStats(models.Model): @@ -74,7 +74,7 @@ class Meta: managed = True db_table = 'nircam_bias_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSBiasQueryHistory(models.Model): @@ -91,7 +91,7 @@ class Meta: managed = True db_table = 'niriss_bias_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSBiasStats(models.Model): @@ -121,7 +121,7 @@ class Meta: managed = True db_table = 'niriss_bias_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecBiasQueryHistory(models.Model): @@ -138,7 +138,7 @@ class Meta: managed = True db_table = 'nirspec_bias_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecBiasStats(models.Model): @@ -168,4 +168,4 @@ class Meta: managed = True db_table = 'nirspec_bias_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/claw.py b/jwql/website/apps/jwql/monitor_models/claw.py index 4e92ea3d4..f59b4d8dd 100644 --- a/jwql/website/apps/jwql/monitor_models/claw.py +++ b/jwql/website/apps/jwql/monitor_models/claw.py @@ -40,7 +40,7 @@ class Meta: managed = True db_table = 'nircam_claw_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamClawStats(models.Model): @@ -67,4 +67,4 @@ class Meta: managed = True db_table = 'nircam_claw_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/common.py b/jwql/website/apps/jwql/monitor_models/common.py index 9809e843c..6be8bbb85 100644 --- a/jwql/website/apps/jwql/monitor_models/common.py +++ b/jwql/website/apps/jwql/monitor_models/common.py @@ -127,7 +127,7 @@ class Meta: managed = True db_table = 'niriss_my_monitor_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' then you would create a new entry as follows: @@ -150,7 +150,7 @@ class Meta: * Django doesn't have a built-in array data type, so you need to import it from the database-compatibility layers. The ArrayField takes, as a required argument, the type of data that makes up the array. -* In the Meta sub-class of the monitor class, the `app_label = 'monitors'` statement is +* In the Meta sub-class of the monitor class, the `db_table_comments = 'monitors'` statement is required so that django knows that the model should be stored in the monitors table. * The `float()` casts are required because the database interface doesn't understand numpy data types. @@ -191,7 +191,7 @@ def db_for_read(self, model, **hints): """ Attempts to read monitor models go to monitors db. """ - if model._meta.app_label in self.route_app_labels: + if model._meta.db_table_comment in self.route_app_labels: return "monitors" return None @@ -199,7 +199,7 @@ def db_for_write(self, model, **hints): """ Attempts to write monitor models go to monitors db. """ - if model._meta.app_label in self.route_app_labels: + if model._meta.db_table_comment in self.route_app_labels: return "monitors" return None @@ -208,8 +208,8 @@ def allow_relation(self, obj1, obj2, **hints): Allow relations between tables in the monitors DB. """ if ( - obj1._meta.app_label in self.route_app_labels - or obj2._meta.app_label in self.route_app_labels + obj1._meta.db_table_comment in self.route_app_labels + or obj2._meta.db_table_comment in self.route_app_labels ): return True return None @@ -218,7 +218,7 @@ def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the monitors apps only appear in the 'monitors' database. """ - if app_label in self.route_app_labels: + if app_label in self.route_app_labels or app_label == 'jwql': return db == "monitors" return None @@ -233,7 +233,7 @@ class Monitor(models.Model): class Meta: managed = True db_table = 'monitor' - app_label = 'monitors' + db_table_comments = 'monitors' class CentralStorage(models.Model): @@ -246,7 +246,7 @@ class CentralStorage(models.Model): class Meta: managed = True db_table = 'central_storage' - app_label = 'monitors' + db_table_comments = 'monitors' class FilesystemCharacteristics(models.Model): @@ -258,7 +258,7 @@ class FilesystemCharacteristics(models.Model): class Meta: managed = True db_table = 'filesystem_characteristics' - app_label = 'monitors' + db_table_comments = 'monitors' class FilesystemGeneral(models.Model): @@ -273,7 +273,7 @@ class FilesystemGeneral(models.Model): class Meta: managed = True db_table = 'filesystem_general' - app_label = 'monitors' + db_table_comments = 'monitors' class FilesystemInstrument(models.Model): @@ -287,7 +287,7 @@ class Meta: managed = True db_table = 'filesystem_instrument' unique_together = (('date', 'instrument', 'filetype'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FgsAnomaly(models.Model): @@ -308,7 +308,7 @@ class FgsAnomaly(models.Model): class Meta: managed = True db_table = 'fgs_anomaly' - app_label = 'monitors' + db_table_comments = 'monitors' class MiriAnomaly(models.Model): @@ -334,7 +334,7 @@ class MiriAnomaly(models.Model): class Meta: managed = True db_table = 'miri_anomaly' - app_label = 'monitors' + db_table_comments = 'monitors' class NircamAnomaly(models.Model): @@ -360,7 +360,7 @@ class NircamAnomaly(models.Model): class Meta: managed = True db_table = 'nircam_anomaly' - app_label = 'monitors' + db_table_comments = 'monitors' class NirissAnomaly(models.Model): @@ -383,7 +383,7 @@ class NirissAnomaly(models.Model): class Meta: managed = True db_table = 'niriss_anomaly' - app_label = 'monitors' + db_table_comments = 'monitors' class NirspecAnomaly(models.Model): @@ -406,4 +406,4 @@ class NirspecAnomaly(models.Model): class Meta: managed = True db_table = 'nirspec_anomaly' - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/cosmic_ray.py b/jwql/website/apps/jwql/monitor_models/cosmic_ray.py index f9084aa06..face1f97e 100644 --- a/jwql/website/apps/jwql/monitor_models/cosmic_ray.py +++ b/jwql/website/apps/jwql/monitor_models/cosmic_ray.py @@ -43,7 +43,7 @@ class Meta: managed = True db_table = 'fgs_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSCosmicRayStats(models.Model): @@ -61,7 +61,7 @@ class Meta: managed = True db_table = 'fgs_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRICosmicRayQueryHistory(models.Model): @@ -77,7 +77,7 @@ class Meta: managed = True db_table = 'miri_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRICosmicRayStats(models.Model): @@ -95,7 +95,7 @@ class Meta: managed = True db_table = 'miri_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamCosmicRayQueryHistory(models.Model): @@ -111,7 +111,7 @@ class Meta: managed = True db_table = 'nircam_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamCosmicRayStats(models.Model): @@ -129,7 +129,7 @@ class Meta: managed = True db_table = 'nircam_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSCosmicRayQueryHistory(models.Model): @@ -145,7 +145,7 @@ class Meta: managed = True db_table = 'niriss_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSCosmicRayStats(models.Model): @@ -163,7 +163,7 @@ class Meta: managed = True db_table = 'niriss_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecCosmicRayQueryHistory(models.Model): @@ -179,7 +179,7 @@ class Meta: managed = True db_table = 'nirspec_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecCosmicRayStats(models.Model): @@ -197,4 +197,4 @@ class Meta: managed = True db_table = 'nirspec_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/dark_current.py b/jwql/website/apps/jwql/monitor_models/dark_current.py index 29d9a9523..39310ab25 100644 --- a/jwql/website/apps/jwql/monitor_models/dark_current.py +++ b/jwql/website/apps/jwql/monitor_models/dark_current.py @@ -60,7 +60,7 @@ class Meta: managed = True db_table = 'fgs_dark_dark_current' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSDarkPixelStats(models.Model): @@ -80,7 +80,7 @@ class Meta: managed = True db_table = 'fgs_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSDarkQueryHistory(models.Model): @@ -97,7 +97,7 @@ class Meta: managed = True db_table = 'fgs_dark_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIDarkDarkCurrent(models.Model): @@ -130,7 +130,7 @@ class Meta: managed = True db_table = 'miri_dark_dark_current' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIDarkPixelStats(models.Model): @@ -150,7 +150,7 @@ class Meta: managed = True db_table = 'miri_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIDarkQueryHistory(models.Model): @@ -167,7 +167,7 @@ class Meta: managed = True db_table = 'miri_dark_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamDarkDarkCurrent(models.Model): @@ -200,7 +200,7 @@ class Meta: managed = True db_table = 'nircam_dark_dark_current' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamDarkPixelStats(models.Model): @@ -220,7 +220,7 @@ class Meta: managed = True db_table = 'nircam_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamDarkQueryHistory(models.Model): @@ -237,7 +237,7 @@ class Meta: managed = True db_table = 'nircam_dark_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSDarkDarkCurrent(models.Model): @@ -270,7 +270,7 @@ class Meta: managed = True db_table = 'niriss_dark_dark_current' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSDarkPixelStats(models.Model): @@ -290,7 +290,7 @@ class Meta: managed = True db_table = 'niriss_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSDarkQueryHistory(models.Model): @@ -307,7 +307,7 @@ class Meta: managed = True db_table = 'niriss_dark_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecDarkDarkCurrent(models.Model): @@ -340,7 +340,7 @@ class Meta: managed = True db_table = 'nirspec_dark_dark_current' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecDarkPixelStats(models.Model): @@ -360,7 +360,7 @@ class Meta: managed = True db_table = 'nirspec_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecDarkQueryHistory(models.Model): @@ -377,4 +377,4 @@ class Meta: managed = True db_table = 'nirspec_dark_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/edb.py b/jwql/website/apps/jwql/monitor_models/edb.py index cc9d8ec82..d5c568c0d 100644 --- a/jwql/website/apps/jwql/monitor_models/edb.py +++ b/jwql/website/apps/jwql/monitor_models/edb.py @@ -45,7 +45,7 @@ class Meta: managed = True db_table = 'fgs_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSEdbDailyStats(models.Model): @@ -63,7 +63,7 @@ class Meta: managed = True db_table = 'fgs_edb_daily_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSEdbEveryChangeStats(models.Model): @@ -81,7 +81,7 @@ class Meta: managed = True db_table = 'fgs_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSEdbTimeIntervalStats(models.Model): @@ -99,7 +99,7 @@ class Meta: managed = True db_table = 'fgs_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSEdbTimeStats(models.Model): @@ -114,7 +114,7 @@ class Meta: managed = True db_table = 'fgs_edb_time_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIEdbBlocksStats(models.Model): @@ -132,7 +132,7 @@ class Meta: managed = True db_table = 'miri_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIEdbDailyStats(models.Model): @@ -150,7 +150,7 @@ class Meta: managed = True db_table = 'miri_edb_daily_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIEdbEveryChangeStats(models.Model): @@ -168,7 +168,7 @@ class Meta: managed = True db_table = 'miri_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIEdbTimeIntervalStats(models.Model): @@ -186,7 +186,7 @@ class Meta: managed = True db_table = 'miri_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIEdbTimeStats(models.Model): @@ -201,7 +201,7 @@ class Meta: managed = True db_table = 'miri_edb_time_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamEdbBlocksStats(models.Model): @@ -219,7 +219,7 @@ class Meta: managed = True db_table = 'nircam_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamEdbDailyStats(models.Model): @@ -237,7 +237,7 @@ class Meta: managed = True db_table = 'nircam_edb_daily_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamEdbEveryChangeStats(models.Model): @@ -255,7 +255,7 @@ class Meta: managed = True db_table = 'nircam_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamEdbTimeIntervalStats(models.Model): @@ -273,7 +273,7 @@ class Meta: managed = True db_table = 'nircam_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamEdbTimeStats(models.Model): @@ -288,7 +288,7 @@ class Meta: managed = True db_table = 'nircam_edb_time_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSEdbBlocksStats(models.Model): @@ -306,7 +306,7 @@ class Meta: managed = True db_table = 'niriss_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSEdbDailyStats(models.Model): @@ -324,7 +324,7 @@ class Meta: managed = True db_table = 'niriss_edb_daily_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSEdbEveryChangeStats(models.Model): @@ -342,7 +342,7 @@ class Meta: managed = True db_table = 'niriss_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSEdbTimeIntervalStats(models.Model): @@ -360,7 +360,7 @@ class Meta: managed = True db_table = 'niriss_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSEdbTimeStats(models.Model): @@ -375,7 +375,7 @@ class Meta: managed = True db_table = 'niriss_edb_time_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecEdbBlocksStats(models.Model): @@ -393,7 +393,7 @@ class Meta: managed = True db_table = 'nirspec_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecEdbDailyStats(models.Model): @@ -411,7 +411,7 @@ class Meta: managed = True db_table = 'nirspec_edb_daily_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecEdbEveryChangeStats(models.Model): @@ -429,7 +429,7 @@ class Meta: managed = True db_table = 'nirspec_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecEdbTimeIntervalStats(models.Model): @@ -447,7 +447,7 @@ class Meta: managed = True db_table = 'nirspec_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecEdbTimeStats(models.Model): @@ -462,4 +462,4 @@ class Meta: managed = True db_table = 'nirspec_edb_time_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/grating.py b/jwql/website/apps/jwql/monitor_models/grating.py index 9e4268879..057253f49 100644 --- a/jwql/website/apps/jwql/monitor_models/grating.py +++ b/jwql/website/apps/jwql/monitor_models/grating.py @@ -40,7 +40,7 @@ class Meta: managed = True db_table = 'nirspec_grating_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecGratingStats(models.Model): @@ -70,4 +70,4 @@ class Meta: managed = True db_table = 'nirspec_grating_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/readnoise.py b/jwql/website/apps/jwql/monitor_models/readnoise.py index 5a500c709..2944e7f17 100644 --- a/jwql/website/apps/jwql/monitor_models/readnoise.py +++ b/jwql/website/apps/jwql/monitor_models/readnoise.py @@ -44,7 +44,7 @@ class Meta: managed = True db_table = 'fgs_readnoise_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class FGSReadnoiseStats(models.Model): @@ -88,7 +88,7 @@ class Meta: managed = True db_table = 'fgs_readnoise_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIReadnoiseQueryHistory(models.Model): @@ -105,7 +105,7 @@ class Meta: managed = True db_table = 'miri_readnoise_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRIReadnoiseStats(models.Model): @@ -149,7 +149,7 @@ class Meta: managed = True db_table = 'miri_readnoise_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamReadnoiseQueryHistory(models.Model): @@ -166,7 +166,7 @@ class Meta: managed = True db_table = 'nircam_readnoise_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRCamReadnoiseStats(models.Model): @@ -210,7 +210,7 @@ class Meta: managed = True db_table = 'nircam_readnoise_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSReadnoiseQueryHistory(models.Model): @@ -227,7 +227,7 @@ class Meta: managed = True db_table = 'niriss_readnoise_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRISSReadnoiseStats(models.Model): @@ -271,7 +271,7 @@ class Meta: managed = True db_table = 'niriss_readnoise_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecReadnoiseQueryHistory(models.Model): @@ -288,7 +288,7 @@ class Meta: managed = True db_table = 'nirspec_readnoise_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecReadnoiseStats(models.Model): @@ -332,4 +332,4 @@ class Meta: managed = True db_table = 'nirspec_readnoise_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/ta.py b/jwql/website/apps/jwql/monitor_models/ta.py index e48433dee..57da66f40 100644 --- a/jwql/website/apps/jwql/monitor_models/ta.py +++ b/jwql/website/apps/jwql/monitor_models/ta.py @@ -44,7 +44,7 @@ class Meta: managed = True db_table = 'miri_ta_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class MIRITaStats(models.Model): @@ -63,7 +63,7 @@ class Meta: managed = True db_table = 'miri_ta_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecTaQueryHistory(models.Model): @@ -80,7 +80,7 @@ class Meta: managed = True db_table = 'nirspec_ta_query_history' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' class NIRSpecTaStats(models.Model): @@ -122,4 +122,4 @@ class Meta: managed = True db_table = 'nirspec_ta_stats' unique_together = (('id', 'entry_date'),) - app_label = 'monitors' + db_table_comments = 'monitors' From 98aefb3a05e862dff730a4ebab63630ef7d5c895 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 14:59:53 -0500 Subject: [PATCH 02/16] typo --- .../apps/jwql/monitor_models/bad_pixel.py | 20 ++++---- jwql/website/apps/jwql/monitor_models/bias.py | 12 ++--- jwql/website/apps/jwql/monitor_models/claw.py | 4 +- .../apps/jwql/monitor_models/common.py | 24 ++++----- .../apps/jwql/monitor_models/cosmic_ray.py | 20 ++++---- .../apps/jwql/monitor_models/dark_current.py | 30 +++++------ jwql/website/apps/jwql/monitor_models/edb.py | 50 +++++++++---------- .../apps/jwql/monitor_models/grating.py | 4 +- .../apps/jwql/monitor_models/readnoise.py | 20 ++++---- jwql/website/apps/jwql/monitor_models/ta.py | 8 +-- 10 files changed, 96 insertions(+), 96 deletions(-) diff --git a/jwql/website/apps/jwql/monitor_models/bad_pixel.py b/jwql/website/apps/jwql/monitor_models/bad_pixel.py index 7e53e8a78..846e38dbf 100644 --- a/jwql/website/apps/jwql/monitor_models/bad_pixel.py +++ b/jwql/website/apps/jwql/monitor_models/bad_pixel.py @@ -48,7 +48,7 @@ class Meta: managed = True db_table = 'fgs_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSBadPixelStats(models.Model): @@ -67,7 +67,7 @@ class Meta: managed = True db_table = 'fgs_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIBadPixelQueryHistory(models.Model): @@ -88,7 +88,7 @@ class Meta: managed = True db_table = 'miri_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIBadPixelStats(models.Model): @@ -107,7 +107,7 @@ class Meta: managed = True db_table = 'miri_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamBadPixelQueryHistory(models.Model): @@ -128,7 +128,7 @@ class Meta: managed = True db_table = 'nircam_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamBadPixelStats(models.Model): @@ -147,7 +147,7 @@ class Meta: managed = True db_table = 'nircam_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSBadPixelQueryHistory(models.Model): @@ -168,7 +168,7 @@ class Meta: managed = True db_table = 'niriss_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSBadPixelStats(models.Model): @@ -187,7 +187,7 @@ class Meta: managed = True db_table = 'niriss_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecBadPixelQueryHistory(models.Model): @@ -208,7 +208,7 @@ class Meta: managed = True db_table = 'nirspec_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecBadPixelStats(models.Model): @@ -227,4 +227,4 @@ class Meta: managed = True db_table = 'nirspec_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/bias.py b/jwql/website/apps/jwql/monitor_models/bias.py index e280c44d9..92778b750 100644 --- a/jwql/website/apps/jwql/monitor_models/bias.py +++ b/jwql/website/apps/jwql/monitor_models/bias.py @@ -44,7 +44,7 @@ class Meta: managed = True db_table = 'nircam_bias_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamBiasStats(models.Model): @@ -74,7 +74,7 @@ class Meta: managed = True db_table = 'nircam_bias_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSBiasQueryHistory(models.Model): @@ -91,7 +91,7 @@ class Meta: managed = True db_table = 'niriss_bias_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSBiasStats(models.Model): @@ -121,7 +121,7 @@ class Meta: managed = True db_table = 'niriss_bias_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecBiasQueryHistory(models.Model): @@ -138,7 +138,7 @@ class Meta: managed = True db_table = 'nirspec_bias_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecBiasStats(models.Model): @@ -168,4 +168,4 @@ class Meta: managed = True db_table = 'nirspec_bias_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/claw.py b/jwql/website/apps/jwql/monitor_models/claw.py index f59b4d8dd..93e158dab 100644 --- a/jwql/website/apps/jwql/monitor_models/claw.py +++ b/jwql/website/apps/jwql/monitor_models/claw.py @@ -40,7 +40,7 @@ class Meta: managed = True db_table = 'nircam_claw_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamClawStats(models.Model): @@ -67,4 +67,4 @@ class Meta: managed = True db_table = 'nircam_claw_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/common.py b/jwql/website/apps/jwql/monitor_models/common.py index 6be8bbb85..ccaaa5bb4 100644 --- a/jwql/website/apps/jwql/monitor_models/common.py +++ b/jwql/website/apps/jwql/monitor_models/common.py @@ -127,7 +127,7 @@ class Meta: managed = True db_table = 'niriss_my_monitor_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' then you would create a new entry as follows: @@ -150,7 +150,7 @@ class Meta: * Django doesn't have a built-in array data type, so you need to import it from the database-compatibility layers. The ArrayField takes, as a required argument, the type of data that makes up the array. -* In the Meta sub-class of the monitor class, the `db_table_comments = 'monitors'` statement is +* In the Meta sub-class of the monitor class, the `db_table_comment = 'monitors'` statement is required so that django knows that the model should be stored in the monitors table. * The `float()` casts are required because the database interface doesn't understand numpy data types. @@ -233,7 +233,7 @@ class Monitor(models.Model): class Meta: managed = True db_table = 'monitor' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class CentralStorage(models.Model): @@ -246,7 +246,7 @@ class CentralStorage(models.Model): class Meta: managed = True db_table = 'central_storage' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FilesystemCharacteristics(models.Model): @@ -258,7 +258,7 @@ class FilesystemCharacteristics(models.Model): class Meta: managed = True db_table = 'filesystem_characteristics' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FilesystemGeneral(models.Model): @@ -273,7 +273,7 @@ class FilesystemGeneral(models.Model): class Meta: managed = True db_table = 'filesystem_general' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FilesystemInstrument(models.Model): @@ -287,7 +287,7 @@ class Meta: managed = True db_table = 'filesystem_instrument' unique_together = (('date', 'instrument', 'filetype'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FgsAnomaly(models.Model): @@ -308,7 +308,7 @@ class FgsAnomaly(models.Model): class Meta: managed = True db_table = 'fgs_anomaly' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MiriAnomaly(models.Model): @@ -334,7 +334,7 @@ class MiriAnomaly(models.Model): class Meta: managed = True db_table = 'miri_anomaly' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NircamAnomaly(models.Model): @@ -360,7 +360,7 @@ class NircamAnomaly(models.Model): class Meta: managed = True db_table = 'nircam_anomaly' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NirissAnomaly(models.Model): @@ -383,7 +383,7 @@ class NirissAnomaly(models.Model): class Meta: managed = True db_table = 'niriss_anomaly' - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NirspecAnomaly(models.Model): @@ -406,4 +406,4 @@ class NirspecAnomaly(models.Model): class Meta: managed = True db_table = 'nirspec_anomaly' - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/cosmic_ray.py b/jwql/website/apps/jwql/monitor_models/cosmic_ray.py index face1f97e..aa0ae499b 100644 --- a/jwql/website/apps/jwql/monitor_models/cosmic_ray.py +++ b/jwql/website/apps/jwql/monitor_models/cosmic_ray.py @@ -43,7 +43,7 @@ class Meta: managed = True db_table = 'fgs_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSCosmicRayStats(models.Model): @@ -61,7 +61,7 @@ class Meta: managed = True db_table = 'fgs_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRICosmicRayQueryHistory(models.Model): @@ -77,7 +77,7 @@ class Meta: managed = True db_table = 'miri_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRICosmicRayStats(models.Model): @@ -95,7 +95,7 @@ class Meta: managed = True db_table = 'miri_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamCosmicRayQueryHistory(models.Model): @@ -111,7 +111,7 @@ class Meta: managed = True db_table = 'nircam_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamCosmicRayStats(models.Model): @@ -129,7 +129,7 @@ class Meta: managed = True db_table = 'nircam_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSCosmicRayQueryHistory(models.Model): @@ -145,7 +145,7 @@ class Meta: managed = True db_table = 'niriss_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSCosmicRayStats(models.Model): @@ -163,7 +163,7 @@ class Meta: managed = True db_table = 'niriss_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecCosmicRayQueryHistory(models.Model): @@ -179,7 +179,7 @@ class Meta: managed = True db_table = 'nirspec_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecCosmicRayStats(models.Model): @@ -197,4 +197,4 @@ class Meta: managed = True db_table = 'nirspec_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/dark_current.py b/jwql/website/apps/jwql/monitor_models/dark_current.py index 39310ab25..cfb1a595f 100644 --- a/jwql/website/apps/jwql/monitor_models/dark_current.py +++ b/jwql/website/apps/jwql/monitor_models/dark_current.py @@ -60,7 +60,7 @@ class Meta: managed = True db_table = 'fgs_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSDarkPixelStats(models.Model): @@ -80,7 +80,7 @@ class Meta: managed = True db_table = 'fgs_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSDarkQueryHistory(models.Model): @@ -97,7 +97,7 @@ class Meta: managed = True db_table = 'fgs_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIDarkDarkCurrent(models.Model): @@ -130,7 +130,7 @@ class Meta: managed = True db_table = 'miri_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIDarkPixelStats(models.Model): @@ -150,7 +150,7 @@ class Meta: managed = True db_table = 'miri_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIDarkQueryHistory(models.Model): @@ -167,7 +167,7 @@ class Meta: managed = True db_table = 'miri_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamDarkDarkCurrent(models.Model): @@ -200,7 +200,7 @@ class Meta: managed = True db_table = 'nircam_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamDarkPixelStats(models.Model): @@ -220,7 +220,7 @@ class Meta: managed = True db_table = 'nircam_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamDarkQueryHistory(models.Model): @@ -237,7 +237,7 @@ class Meta: managed = True db_table = 'nircam_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSDarkDarkCurrent(models.Model): @@ -270,7 +270,7 @@ class Meta: managed = True db_table = 'niriss_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSDarkPixelStats(models.Model): @@ -290,7 +290,7 @@ class Meta: managed = True db_table = 'niriss_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSDarkQueryHistory(models.Model): @@ -307,7 +307,7 @@ class Meta: managed = True db_table = 'niriss_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecDarkDarkCurrent(models.Model): @@ -340,7 +340,7 @@ class Meta: managed = True db_table = 'nirspec_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecDarkPixelStats(models.Model): @@ -360,7 +360,7 @@ class Meta: managed = True db_table = 'nirspec_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecDarkQueryHistory(models.Model): @@ -377,4 +377,4 @@ class Meta: managed = True db_table = 'nirspec_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/edb.py b/jwql/website/apps/jwql/monitor_models/edb.py index d5c568c0d..c9996c23c 100644 --- a/jwql/website/apps/jwql/monitor_models/edb.py +++ b/jwql/website/apps/jwql/monitor_models/edb.py @@ -45,7 +45,7 @@ class Meta: managed = True db_table = 'fgs_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSEdbDailyStats(models.Model): @@ -63,7 +63,7 @@ class Meta: managed = True db_table = 'fgs_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSEdbEveryChangeStats(models.Model): @@ -81,7 +81,7 @@ class Meta: managed = True db_table = 'fgs_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSEdbTimeIntervalStats(models.Model): @@ -99,7 +99,7 @@ class Meta: managed = True db_table = 'fgs_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSEdbTimeStats(models.Model): @@ -114,7 +114,7 @@ class Meta: managed = True db_table = 'fgs_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIEdbBlocksStats(models.Model): @@ -132,7 +132,7 @@ class Meta: managed = True db_table = 'miri_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIEdbDailyStats(models.Model): @@ -150,7 +150,7 @@ class Meta: managed = True db_table = 'miri_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIEdbEveryChangeStats(models.Model): @@ -168,7 +168,7 @@ class Meta: managed = True db_table = 'miri_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIEdbTimeIntervalStats(models.Model): @@ -186,7 +186,7 @@ class Meta: managed = True db_table = 'miri_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIEdbTimeStats(models.Model): @@ -201,7 +201,7 @@ class Meta: managed = True db_table = 'miri_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamEdbBlocksStats(models.Model): @@ -219,7 +219,7 @@ class Meta: managed = True db_table = 'nircam_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamEdbDailyStats(models.Model): @@ -237,7 +237,7 @@ class Meta: managed = True db_table = 'nircam_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamEdbEveryChangeStats(models.Model): @@ -255,7 +255,7 @@ class Meta: managed = True db_table = 'nircam_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamEdbTimeIntervalStats(models.Model): @@ -273,7 +273,7 @@ class Meta: managed = True db_table = 'nircam_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamEdbTimeStats(models.Model): @@ -288,7 +288,7 @@ class Meta: managed = True db_table = 'nircam_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSEdbBlocksStats(models.Model): @@ -306,7 +306,7 @@ class Meta: managed = True db_table = 'niriss_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSEdbDailyStats(models.Model): @@ -324,7 +324,7 @@ class Meta: managed = True db_table = 'niriss_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSEdbEveryChangeStats(models.Model): @@ -342,7 +342,7 @@ class Meta: managed = True db_table = 'niriss_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSEdbTimeIntervalStats(models.Model): @@ -360,7 +360,7 @@ class Meta: managed = True db_table = 'niriss_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSEdbTimeStats(models.Model): @@ -375,7 +375,7 @@ class Meta: managed = True db_table = 'niriss_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecEdbBlocksStats(models.Model): @@ -393,7 +393,7 @@ class Meta: managed = True db_table = 'nirspec_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecEdbDailyStats(models.Model): @@ -411,7 +411,7 @@ class Meta: managed = True db_table = 'nirspec_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecEdbEveryChangeStats(models.Model): @@ -429,7 +429,7 @@ class Meta: managed = True db_table = 'nirspec_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecEdbTimeIntervalStats(models.Model): @@ -447,7 +447,7 @@ class Meta: managed = True db_table = 'nirspec_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecEdbTimeStats(models.Model): @@ -462,4 +462,4 @@ class Meta: managed = True db_table = 'nirspec_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/grating.py b/jwql/website/apps/jwql/monitor_models/grating.py index 057253f49..ac0e13ab5 100644 --- a/jwql/website/apps/jwql/monitor_models/grating.py +++ b/jwql/website/apps/jwql/monitor_models/grating.py @@ -40,7 +40,7 @@ class Meta: managed = True db_table = 'nirspec_grating_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecGratingStats(models.Model): @@ -70,4 +70,4 @@ class Meta: managed = True db_table = 'nirspec_grating_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/readnoise.py b/jwql/website/apps/jwql/monitor_models/readnoise.py index 2944e7f17..a9e3537b4 100644 --- a/jwql/website/apps/jwql/monitor_models/readnoise.py +++ b/jwql/website/apps/jwql/monitor_models/readnoise.py @@ -44,7 +44,7 @@ class Meta: managed = True db_table = 'fgs_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class FGSReadnoiseStats(models.Model): @@ -88,7 +88,7 @@ class Meta: managed = True db_table = 'fgs_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIReadnoiseQueryHistory(models.Model): @@ -105,7 +105,7 @@ class Meta: managed = True db_table = 'miri_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRIReadnoiseStats(models.Model): @@ -149,7 +149,7 @@ class Meta: managed = True db_table = 'miri_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamReadnoiseQueryHistory(models.Model): @@ -166,7 +166,7 @@ class Meta: managed = True db_table = 'nircam_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRCamReadnoiseStats(models.Model): @@ -210,7 +210,7 @@ class Meta: managed = True db_table = 'nircam_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSReadnoiseQueryHistory(models.Model): @@ -227,7 +227,7 @@ class Meta: managed = True db_table = 'niriss_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRISSReadnoiseStats(models.Model): @@ -271,7 +271,7 @@ class Meta: managed = True db_table = 'niriss_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecReadnoiseQueryHistory(models.Model): @@ -288,7 +288,7 @@ class Meta: managed = True db_table = 'nirspec_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecReadnoiseStats(models.Model): @@ -332,4 +332,4 @@ class Meta: managed = True db_table = 'nirspec_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/ta.py b/jwql/website/apps/jwql/monitor_models/ta.py index 57da66f40..e9730d7ab 100644 --- a/jwql/website/apps/jwql/monitor_models/ta.py +++ b/jwql/website/apps/jwql/monitor_models/ta.py @@ -44,7 +44,7 @@ class Meta: managed = True db_table = 'miri_ta_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class MIRITaStats(models.Model): @@ -63,7 +63,7 @@ class Meta: managed = True db_table = 'miri_ta_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecTaQueryHistory(models.Model): @@ -80,7 +80,7 @@ class Meta: managed = True db_table = 'nirspec_ta_query_history' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' class NIRSpecTaStats(models.Model): @@ -122,4 +122,4 @@ class Meta: managed = True db_table = 'nirspec_ta_stats' unique_together = (('id', 'entry_date'),) - db_table_comments = 'monitors' + db_table_comment = 'monitors' From 3fd08dc8ee88c190e722b58ce53e5cf3cc3646e5 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 15:08:18 -0500 Subject: [PATCH 03/16] First try on migration 17 to set up imported tables --- ...maly_filesystemcharacteristics_and_more.py | 620 ++++++++++++++++++ 1 file changed, 620 insertions(+) create mode 100644 jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py diff --git a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py new file mode 100644 index 000000000..12369cbc2 --- /dev/null +++ b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py @@ -0,0 +1,620 @@ +# Generated by Django 4.2.5 on 2024-02-20 20:04 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +def db_select(apps, schema_editor): + if schema_editor.connection.alias == "default": + # Anything that's not for the monitors tables + return + else: + migrations.CreateModel( + name='CentralStorage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField()), + ('area', models.CharField()), + ('size', models.FloatField()), + ('used', models.FloatField()), + ('available', models.FloatField()), + ], + options={ + 'db_table': 'central_storage', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='FgsAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('other', models.BooleanField()), + ], + options={ + 'db_table': 'fgs_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='FilesystemCharacteristics', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField()), + ('instrument', models.TextField()), + ('filter_pupil', models.TextField(blank=True, null=True)), + ('obs_per_filter_pupil', models.TextField(blank=True, null=True)), + ], + options={ + 'db_table': 'filesystem_characteristics', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='FilesystemGeneral', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField(unique=True)), + ('total_file_count', models.IntegerField()), + ('total_file_size', models.FloatField()), + ('fits_file_count', models.IntegerField()), + ('fits_file_size', models.FloatField()), + ('used', models.FloatField()), + ('available', models.FloatField()), + ], + options={ + 'db_table': 'filesystem_general', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='MiriAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('column_pull_up', models.BooleanField()), + ('internal_reflection', models.BooleanField()), + ('row_pull_down', models.BooleanField()), + ('other', models.BooleanField()), + ('column_pull_down', models.BooleanField()), + ('mrs_glow', models.BooleanField(db_column='MRS_Glow')), + ('mrs_zipper', models.BooleanField(db_column='MRS_Zipper')), + ('row_pull_up', models.BooleanField()), + ('lrs_contamination', models.BooleanField(db_column='LRS_Contamination')), + ('tree_rings', models.BooleanField()), + ], + options={ + 'db_table': 'miri_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='Monitor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('monitor_name', models.CharField()), + ('start_time', models.DateTimeField()), + ('end_time', models.DateTimeField(blank=True, null=True)), + ('status', models.TextField(blank=True, null=True)), + ('log_file', models.CharField()), + ], + options={ + 'db_table': 'monitor', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='NircamAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('dragons_breath', models.BooleanField()), + ('other', models.BooleanField()), + ('scattered_light', models.BooleanField()), + ('claws', models.BooleanField()), + ('wisps', models.BooleanField()), + ('tilt_event', models.BooleanField()), + ], + options={ + 'db_table': 'nircam_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='NirissAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('other', models.BooleanField()), + ('scattered_light', models.TextField()), + ('light_saber', models.TextField()), + ], + options={ + 'db_table': 'niriss_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='NirspecAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('dominant_msa_leakage', models.BooleanField(db_column='Dominant_MSA_Leakage')), + ('optical_short', models.BooleanField()), + ('other', models.BooleanField()), + ], + options={ + 'db_table': 'nirspec_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ) + migrations.CreateModel( + name='NIRSpecReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'nirspec_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRSpecReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'nirspec_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRISSReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'niriss_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRISSReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'niriss_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRCamReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'nircam_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRCamReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRCamClawStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('filename', models.CharField(blank=True, null=True)), + ('proposal', models.CharField(blank=True, null=True)), + ('obs', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('filter', models.CharField(blank=True, null=True)), + ('pupil', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('expstart_mjd', models.FloatField(blank=True, null=True)), + ('effexptm', models.FloatField(blank=True, null=True)), + ('ra', models.FloatField(blank=True, null=True)), + ('dec', models.FloatField(blank=True, null=True)), + ('pa_v3', models.FloatField(blank=True, null=True)), + ('mean', models.FloatField(blank=True, null=True)), + ('median', models.FloatField(blank=True, null=True)), + ('stddev', models.FloatField(blank=True, null=True)), + ('frac_masked', models.FloatField(blank=True, null=True)), + ('skyflat_filename', models.CharField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_claw_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='NIRCamClawQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('instrument', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_claw_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='MIRIReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'miri_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='MIRIReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'miri_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='FilesystemInstrument', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField()), + ('instrument', models.TextField()), + ('filetype', models.TextField()), + ('count', models.IntegerField()), + ('size', models.FloatField()), + ], + options={ + 'db_table': 'filesystem_instrument', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('date', 'instrument', 'filetype')}, + }, + ) + migrations.CreateModel( + name='FGSReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'fgs_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + migrations.CreateModel( + name='FGSReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'fgs_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('jwql', '0016_anomalies_bright_object_not_a_short_and_more'), + ] + + operations = [ + migrations.RunPython(db_select), + ] From 7f38aaa62d077b70d516741b66e1a13bfbeea0e3 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 15:21:50 -0500 Subject: [PATCH 04/16] Adding columns to claw table model --- ...maly_filesystemcharacteristics_and_more.py | 2 + ...maly_filesystemcharacteristics_and_more.py | 612 ++++++++++++++++++ jwql/website/apps/jwql/monitor_models/claw.py | 2 + 3 files changed, 616 insertions(+) create mode 100644 jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py diff --git a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py index 12369cbc2..9f69ebd72 100644 --- a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py +++ b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py @@ -2,9 +2,11 @@ import django.contrib.postgres.fields from django.db import migrations, models +import sys def db_select(apps, schema_editor): + sys.stderr.write("\napps: {}, schema_editor: {}, schema_editor.connection.alias: {}\n".format(apps, schema_editor, schema_editor.connections.alias)) if schema_editor.connection.alias == "default": # Anything that's not for the monitors tables return diff --git a/jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py b/jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py new file mode 100644 index 000000000..6f50409cd --- /dev/null +++ b/jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py @@ -0,0 +1,612 @@ +# Generated by Django 4.2.5 on 2024-02-20 20:19 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jwql', '0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='CentralStorage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField()), + ('area', models.CharField()), + ('size', models.FloatField()), + ('used', models.FloatField()), + ('available', models.FloatField()), + ], + options={ + 'db_table': 'central_storage', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='FgsAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('other', models.BooleanField()), + ], + options={ + 'db_table': 'fgs_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='FilesystemCharacteristics', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField()), + ('instrument', models.TextField()), + ('filter_pupil', models.TextField(blank=True, null=True)), + ('obs_per_filter_pupil', models.TextField(blank=True, null=True)), + ], + options={ + 'db_table': 'filesystem_characteristics', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='FilesystemGeneral', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField(unique=True)), + ('total_file_count', models.IntegerField()), + ('total_file_size', models.FloatField()), + ('fits_file_count', models.IntegerField()), + ('fits_file_size', models.FloatField()), + ('used', models.FloatField()), + ('available', models.FloatField()), + ], + options={ + 'db_table': 'filesystem_general', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='MiriAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('column_pull_up', models.BooleanField()), + ('internal_reflection', models.BooleanField()), + ('row_pull_down', models.BooleanField()), + ('other', models.BooleanField()), + ('column_pull_down', models.BooleanField()), + ('mrs_glow', models.BooleanField(db_column='MRS_Glow')), + ('mrs_zipper', models.BooleanField(db_column='MRS_Zipper')), + ('row_pull_up', models.BooleanField()), + ('lrs_contamination', models.BooleanField(db_column='LRS_Contamination')), + ('tree_rings', models.BooleanField()), + ], + options={ + 'db_table': 'miri_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='Monitor', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('monitor_name', models.CharField()), + ('start_time', models.DateTimeField()), + ('end_time', models.DateTimeField(blank=True, null=True)), + ('status', models.TextField(blank=True, null=True)), + ('log_file', models.CharField()), + ], + options={ + 'db_table': 'monitor', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='NircamAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('dragons_breath', models.BooleanField()), + ('other', models.BooleanField()), + ('scattered_light', models.BooleanField()), + ('claws', models.BooleanField()), + ('wisps', models.BooleanField()), + ('tilt_event', models.BooleanField()), + ], + options={ + 'db_table': 'nircam_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='NirissAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('other', models.BooleanField()), + ('scattered_light', models.TextField()), + ('light_saber', models.TextField()), + ], + options={ + 'db_table': 'niriss_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='NirspecAnomaly', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rootname', models.CharField()), + ('flag_date', models.DateTimeField()), + ('user', models.CharField()), + ('cosmic_ray_shower', models.BooleanField()), + ('diffraction_spike', models.BooleanField()), + ('excessive_saturation', models.BooleanField()), + ('guidestar_failure', models.BooleanField()), + ('persistence', models.BooleanField()), + ('crosstalk', models.BooleanField()), + ('data_transfer_error', models.BooleanField()), + ('ghost', models.BooleanField()), + ('snowball', models.BooleanField()), + ('dominant_msa_leakage', models.BooleanField(db_column='Dominant_MSA_Leakage')), + ('optical_short', models.BooleanField()), + ('other', models.BooleanField()), + ], + options={ + 'db_table': 'nirspec_anomaly', + 'db_table_comment': 'monitors', + 'managed': True, + }, + ), + migrations.CreateModel( + name='NIRSpecReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'nirspec_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRSpecReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'nirspec_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRISSReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'niriss_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRISSReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'niriss_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'nircam_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamClawStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('filename', models.CharField(blank=True, null=True)), + ('proposal', models.CharField(blank=True, null=True)), + ('obs', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('filter', models.CharField(blank=True, null=True)), + ('pupil', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('expstart_mjd', models.FloatField(blank=True, null=True)), + ('effexptm', models.FloatField(blank=True, null=True)), + ('ra', models.FloatField(blank=True, null=True)), + ('dec', models.FloatField(blank=True, null=True)), + ('pa_v3', models.FloatField(blank=True, null=True)), + ('mean', models.FloatField(blank=True, null=True)), + ('median', models.FloatField(blank=True, null=True)), + ('stddev', models.FloatField(blank=True, null=True)), + ('frac_masked', models.FloatField(blank=True, null=True)), + ('skyflat_filename', models.CharField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_claw_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamClawQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('instrument', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_claw_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='MIRIReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'miri_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='MIRIReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'miri_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='FilesystemInstrument', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField()), + ('instrument', models.TextField()), + ('filetype', models.TextField()), + ('count', models.IntegerField()), + ('size', models.FloatField()), + ], + options={ + 'db_table': 'filesystem_instrument', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('date', 'instrument', 'filetype')}, + }, + ), + migrations.CreateModel( + name='FGSReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'fgs_readnoise_stats', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='FGSReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'fgs_readnoise_query_history', + 'db_table_comment': 'monitors', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + ] diff --git a/jwql/website/apps/jwql/monitor_models/claw.py b/jwql/website/apps/jwql/monitor_models/claw.py index 93e158dab..e26abb681 100644 --- a/jwql/website/apps/jwql/monitor_models/claw.py +++ b/jwql/website/apps/jwql/monitor_models/claw.py @@ -62,6 +62,8 @@ class NIRCamClawStats(models.Model): stddev = models.FloatField(blank=True, null=True) frac_masked = models.FloatField(blank=True, null=True) skyflat_filename = models.CharField(blank=True, null=True) + doy = models.FloatField(blank=True, null=True) + total_bkg = models.FloatField(blank=True, null=True) class Meta: managed = True From c43599b53fa8380c5f33712e794e3804a4596c40 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 15:32:07 -0500 Subject: [PATCH 05/16] Created migration for claw stats new column --- .../migrations/0019_add_claw_table_fields.py | 33 +++++++++++++++++++ ...clawstats_doy_nircamclawstats_total_bkg.py | 23 +++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py create mode 100644 jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py diff --git a/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py b/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py new file mode 100644 index 000000000..2aa24a938 --- /dev/null +++ b/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.5 on 2024-02-20 20:04 + +import django.contrib.postgres.fields +from django.db import migrations, models +import sys + + +def db_select(apps, schema_editor): + if schema_editor.connection.alias == "default": + # Anything that's not for the monitors tables + return + else: + migrations.AddField( + model_name='nircam_claw_stats', + name='doy', + field=models.FloatField(blank=True, null=True), + ) + migrations.AddField( + model_name='nircam_claw_stats', + name='total_bkg', + field=models.FloatField(blank=True, null=True), + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('jwql', '0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more'), + ] + + operations = [ + migrations.RunPython(db_select), + ] diff --git a/jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py b/jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py new file mode 100644 index 000000000..974af312a --- /dev/null +++ b/jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.5 on 2024-02-20 20:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jwql', '0019_add_claw_table_fields'), + ] + + operations = [ + migrations.AddField( + model_name='nircamclawstats', + name='doy', + field=models.FloatField(blank=True, null=True), + ), + migrations.AddField( + model_name='nircamclawstats', + name='total_bkg', + field=models.FloatField(blank=True, null=True), + ), + ] From 858404fce17c5f1eb21baf6a4beeaa3d9150de2b Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 15:55:56 -0500 Subject: [PATCH 06/16] Added back in the new columns --- jwql/instrument_monitors/nircam_monitors/claw_monitor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jwql/instrument_monitors/nircam_monitors/claw_monitor.py b/jwql/instrument_monitors/nircam_monitors/claw_monitor.py index b5388309d..7a3e3c2ec 100644 --- a/jwql/instrument_monitors/nircam_monitors/claw_monitor.py +++ b/jwql/instrument_monitors/nircam_monitors/claw_monitor.py @@ -138,7 +138,7 @@ def make_background_plots(self, plot_type='bkg'): """ columns = ['filename', 'filter', 'pupil', 'detector', 'effexptm', 'expstart_mjd', 'entry_date', 'mean', 'median', - 'stddev', 'frac_masked'] # , 'total_bkg'] + 'stddev', 'frac_masked', 'total_bkg'] # Get all of the background data. background_data = NIRCamClawStats.objects.all().values(*columns) @@ -331,8 +331,8 @@ def process(self): 'stddev': float(stddev), 'frac_masked': len(segmap_orig[(segmap_orig != 0) | (dq & 1 != 0)]) / (segmap_orig.shape[0] * segmap_orig.shape[1]), 'skyflat_filename': os.path.basename(self.outfile), - # 'doy': float(doy), - # 'total_bkg': float(total_bkg), + 'doy': float(doy), + 'total_bkg': float(total_bkg), 'entry_date': datetime.datetime.now() } entry = self.stats_table(**claw_db_entry) From 8baa64ad06f19cf74f35ff297da2d4b953d14d79 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Tue, 20 Feb 2024 18:09:35 -0500 Subject: [PATCH 07/16] Update claw monitor to filter at the query stage rather than after making a dataframe --- jwql/website/apps/jwql/monitor_views.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/jwql/website/apps/jwql/monitor_views.py b/jwql/website/apps/jwql/monitor_views.py index 79ac6f127..fa6f48204 100644 --- a/jwql/website/apps/jwql/monitor_views.py +++ b/jwql/website/apps/jwql/monitor_views.py @@ -157,10 +157,9 @@ def claw_monitor(request): template = "claw_monitor.html" # Get all recent claw stack images from the last 10 days - query = NIRCamClawStats.objects # .filter(expstart_mjd__gte=(Time.now().mjd - 10)) - query = query.order_by('-expstart_mjd').all().values('expstart_mjd', 'skyflat_filename') - df = pd.DataFrame.from_records(query) - recent_files = list(pd.unique(df['skyflat_filename'][df['expstart_mjd'] > Time.now().mjd - 10])) + query = NIRCamClawStats.objects.filter(expstart_mjd__gte=(Time.now().mjd - 10)) + query = query.order_by('-expstart_mjd').all().values('skyflat_filename') + recent_files = list(pd.unique(pd.DataFrame.from_records(query)['skyflat_filename'])) output_dir_claws = static(os.path.join("outputs", "claw_monitor", "claw_stacks")) claw_stacks = [os.path.join(output_dir_claws, filename) for filename in recent_files] From 45f62f914c6a27961abe4bbf6481c261be4fee7d Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 12:37:17 -0500 Subject: [PATCH 08/16] Added back in a comment-out that I had forgotten to put back in initially --- jwql/instrument_monitors/nircam_monitors/claw_monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jwql/instrument_monitors/nircam_monitors/claw_monitor.py b/jwql/instrument_monitors/nircam_monitors/claw_monitor.py index 7a3e3c2ec..f6d257652 100644 --- a/jwql/instrument_monitors/nircam_monitors/claw_monitor.py +++ b/jwql/instrument_monitors/nircam_monitors/claw_monitor.py @@ -193,7 +193,7 @@ def make_background_plots(self, plot_type='bkg'): plot_data = df['stddev'].values if plot_type == 'model': total_bkg = [1. for x in df['median'].values] - plot_data = df['median'].values # / df['total_bkg'].values + plot_data = df['median'].values / df['total_bkg'].values plot_expstarts = df['expstart_mjd'].values # Plot the background data over time From 447a447654c10dc9a6bae58a67509d14caa4c3f7 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 14:31:18 -0500 Subject: [PATCH 09/16] Updated router as per @bsappington's comments --- jwql/utils/constants.py | 46 +++++++++++++ .../apps/jwql/monitor_models/bad_pixel.py | 10 --- jwql/website/apps/jwql/monitor_models/bias.py | 6 -- jwql/website/apps/jwql/monitor_models/claw.py | 2 - .../apps/jwql/monitor_models/common.py | 57 +--------------- .../apps/jwql/monitor_models/cosmic_ray.py | 10 --- .../apps/jwql/monitor_models/dark_current.py | 15 ----- jwql/website/apps/jwql/monitor_models/edb.py | 25 ------- .../apps/jwql/monitor_models/grating.py | 2 - .../apps/jwql/monitor_models/readnoise.py | 10 --- jwql/website/apps/jwql/monitor_models/ta.py | 4 -- jwql/website/apps/jwql/router.py | 65 +++++++++++++++++++ jwql/website/jwql_proj/settings.py | 2 +- 13 files changed, 113 insertions(+), 141 deletions(-) create mode 100644 jwql/website/apps/jwql/router.py diff --git a/jwql/utils/constants.py b/jwql/utils/constants.py index d6791f489..b19110263 100644 --- a/jwql/utils/constants.py +++ b/jwql/utils/constants.py @@ -653,6 +653,52 @@ }, } +# Names of all of the monitor database tables +MONITOR_TABLE_NAMES = [ + "FGSBadPixelQueryHistory", "FGSBadPixelStats", + "MIRIBadPixelQueryHistory", "MIRIBadPixelStats", + "NIRCamBadPixelQueryHistory", "NIRCamBadPixelStats", + "NIRISSBadPixelQueryHistory", "NIRISSBadPixelStats", + "NIRSpecBadPixelQueryHistory", "NIRSpecBadPixelStats", + "NIRCamBiasQueryHistory", "NIRCamBiasStats", + "NIRISSBiasQueryHistory", "NIRISSBiasStats", + "NIRSpecBiasQueryHistory", "NIRSpecBiasStats", + "NIRCamClawQueryHistory", "NIRCamClawStats", + "Monitor", + "CentralStorage", + "FilesystemCharacteristics", + "FilesystemGeneral", + "FilesystemInstrument", + "FgsAnomaly", + "MiriAnomaly", + "NircamAnomaly", + "NirissAnomaly", + "NirspecAnomaly", + "FGSCosmicRayQueryHistory", "FGSCosmicRayStats", + "MIRICosmicRayQueryHistory", "MIRICosmicRayStats", + "NIRCamCosmicRayQueryHistory", "NIRCamCosmicRayStats", + "NIRISSCosmicRayQueryHistory", "NIRISSCosmicRayStats", + "NIRSpecCosmicRayQueryHistory", "NIRSpecCosmicRayStats", + "FGSDarkDarkCurrent", "FGSDarkPixelStats", "FGSDarkQueryHistory", + "MIRIDarkDarkCurrent", "MIRIDarkPixelStats", "MIRIDarkQueryHistory", + "NIRCamDarkDarkCurrent", "NIRCamDarkPixelStats", "NIRCamDarkQueryHistory", + "NIRISSDarkDarkCurrent", "NIRISSDarkPixelStats", "NIRISSDarkQueryHistory", + "NIRSpecDarkDarkCurrent", "NIRSpecDarkPixelStats", "NIRSpecDarkQueryHistory", + "FGSEdbBlocksStats", "FGSEdbDailyStats", "FGSEdbEveryChangeStats", "FGSEdbTimeIntervalStats", "FGSEdbTimeStats", + "MIRIEdbBlocksStats", "MIRIEdbDailyStats", "MIRIEdbEveryChangeStats", "MIRIEdbTimeIntervalStats", "MIRIEdbTimeStats", + "NIRCamEdbBlocksStats", "NIRCamEdbDailyStats", "NIRCamEdbEveryChangeStats", "NIRCamEdbTimeIntervalStats", "NIRCamEdbTimeStats", + "NIRISSEdbBlocksStats", "NIRISSEdbDailyStats", "NIRISSEdbEveryChangeStats", "NIRISSEdbTimeIntervalStats", "NIRISSEdbTimeStats", + "NIRSpecEdbBlocksStats", "NIRSpecEdbDailyStats", "NIRSpecEdbEveryChangeStats", "NIRSpecEdbTimeIntervalStats", "NIRSpecEdbTimeStats", + "NIRSpecGratingStats", + "FGSReadnoiseQueryHistory", "FGSReadnoiseStats", + "MIRIReadnoiseQueryHistory", "MIRIReadnoiseStats", + "NIRCamReadnoiseQueryHistory", "NIRCamReadnoiseStats", + "NIRISSReadnoiseQueryHistory", "NIRISSReadnoiseStats", + "NIRSpecReadnoiseQueryHistory", "NIRSpecReadnoiseStats", + "MIRITaQueryHistory", "MIRITaStats", + "NIRSpecTaQueryHistory", "NIRSpecTaStats" +] + # Suffix for msa files MSA_SUFFIX = ["msa"] diff --git a/jwql/website/apps/jwql/monitor_models/bad_pixel.py b/jwql/website/apps/jwql/monitor_models/bad_pixel.py index 846e38dbf..463331deb 100644 --- a/jwql/website/apps/jwql/monitor_models/bad_pixel.py +++ b/jwql/website/apps/jwql/monitor_models/bad_pixel.py @@ -48,7 +48,6 @@ class Meta: managed = True db_table = 'fgs_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSBadPixelStats(models.Model): @@ -67,7 +66,6 @@ class Meta: managed = True db_table = 'fgs_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIBadPixelQueryHistory(models.Model): @@ -88,7 +86,6 @@ class Meta: managed = True db_table = 'miri_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIBadPixelStats(models.Model): @@ -107,7 +104,6 @@ class Meta: managed = True db_table = 'miri_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamBadPixelQueryHistory(models.Model): @@ -128,7 +124,6 @@ class Meta: managed = True db_table = 'nircam_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamBadPixelStats(models.Model): @@ -147,7 +142,6 @@ class Meta: managed = True db_table = 'nircam_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSBadPixelQueryHistory(models.Model): @@ -168,7 +162,6 @@ class Meta: managed = True db_table = 'niriss_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSBadPixelStats(models.Model): @@ -187,7 +180,6 @@ class Meta: managed = True db_table = 'niriss_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecBadPixelQueryHistory(models.Model): @@ -208,7 +200,6 @@ class Meta: managed = True db_table = 'nirspec_bad_pixel_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecBadPixelStats(models.Model): @@ -227,4 +218,3 @@ class Meta: managed = True db_table = 'nirspec_bad_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/bias.py b/jwql/website/apps/jwql/monitor_models/bias.py index 92778b750..c8245b9fe 100644 --- a/jwql/website/apps/jwql/monitor_models/bias.py +++ b/jwql/website/apps/jwql/monitor_models/bias.py @@ -44,7 +44,6 @@ class Meta: managed = True db_table = 'nircam_bias_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamBiasStats(models.Model): @@ -74,7 +73,6 @@ class Meta: managed = True db_table = 'nircam_bias_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSBiasQueryHistory(models.Model): @@ -91,7 +89,6 @@ class Meta: managed = True db_table = 'niriss_bias_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSBiasStats(models.Model): @@ -121,7 +118,6 @@ class Meta: managed = True db_table = 'niriss_bias_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecBiasQueryHistory(models.Model): @@ -138,7 +134,6 @@ class Meta: managed = True db_table = 'nirspec_bias_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecBiasStats(models.Model): @@ -168,4 +163,3 @@ class Meta: managed = True db_table = 'nirspec_bias_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/claw.py b/jwql/website/apps/jwql/monitor_models/claw.py index e26abb681..a1c6c93e3 100644 --- a/jwql/website/apps/jwql/monitor_models/claw.py +++ b/jwql/website/apps/jwql/monitor_models/claw.py @@ -40,7 +40,6 @@ class Meta: managed = True db_table = 'nircam_claw_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamClawStats(models.Model): @@ -69,4 +68,3 @@ class Meta: managed = True db_table = 'nircam_claw_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/common.py b/jwql/website/apps/jwql/monitor_models/common.py index ccaaa5bb4..5114e641a 100644 --- a/jwql/website/apps/jwql/monitor_models/common.py +++ b/jwql/website/apps/jwql/monitor_models/common.py @@ -127,8 +127,7 @@ class Meta: managed = True db_table = 'niriss_my_monitor_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' - + then you would create a new entry as follows: .. code-block:: python @@ -179,50 +178,6 @@ class Meta: from django.contrib.postgres.fields import ArrayField -class MonitorRouter: - """ - A router to control all database operations on models in the - JWQLDB (monitors) database. - """ - - route_app_labels = {"monitors"} - - def db_for_read(self, model, **hints): - """ - Attempts to read monitor models go to monitors db. - """ - if model._meta.db_table_comment in self.route_app_labels: - return "monitors" - return None - - def db_for_write(self, model, **hints): - """ - Attempts to write monitor models go to monitors db. - """ - if model._meta.db_table_comment in self.route_app_labels: - return "monitors" - return None - - def allow_relation(self, obj1, obj2, **hints): - """ - Allow relations between tables in the monitors DB. - """ - if ( - obj1._meta.db_table_comment in self.route_app_labels - or obj2._meta.db_table_comment in self.route_app_labels - ): - return True - return None - - def allow_migrate(self, db, app_label, model_name=None, **hints): - """ - Make sure the monitors apps only appear in the 'monitors' database. - """ - if app_label in self.route_app_labels or app_label == 'jwql': - return db == "monitors" - return None - - class Monitor(models.Model): monitor_name = models.CharField() start_time = models.DateTimeField() @@ -233,7 +188,6 @@ class Monitor(models.Model): class Meta: managed = True db_table = 'monitor' - db_table_comment = 'monitors' class CentralStorage(models.Model): @@ -246,7 +200,6 @@ class CentralStorage(models.Model): class Meta: managed = True db_table = 'central_storage' - db_table_comment = 'monitors' class FilesystemCharacteristics(models.Model): @@ -258,7 +211,6 @@ class FilesystemCharacteristics(models.Model): class Meta: managed = True db_table = 'filesystem_characteristics' - db_table_comment = 'monitors' class FilesystemGeneral(models.Model): @@ -273,7 +225,6 @@ class FilesystemGeneral(models.Model): class Meta: managed = True db_table = 'filesystem_general' - db_table_comment = 'monitors' class FilesystemInstrument(models.Model): @@ -287,7 +238,6 @@ class Meta: managed = True db_table = 'filesystem_instrument' unique_together = (('date', 'instrument', 'filetype'),) - db_table_comment = 'monitors' class FgsAnomaly(models.Model): @@ -308,7 +258,6 @@ class FgsAnomaly(models.Model): class Meta: managed = True db_table = 'fgs_anomaly' - db_table_comment = 'monitors' class MiriAnomaly(models.Model): @@ -334,7 +283,6 @@ class MiriAnomaly(models.Model): class Meta: managed = True db_table = 'miri_anomaly' - db_table_comment = 'monitors' class NircamAnomaly(models.Model): @@ -360,7 +308,6 @@ class NircamAnomaly(models.Model): class Meta: managed = True db_table = 'nircam_anomaly' - db_table_comment = 'monitors' class NirissAnomaly(models.Model): @@ -383,7 +330,6 @@ class NirissAnomaly(models.Model): class Meta: managed = True db_table = 'niriss_anomaly' - db_table_comment = 'monitors' class NirspecAnomaly(models.Model): @@ -406,4 +352,3 @@ class NirspecAnomaly(models.Model): class Meta: managed = True db_table = 'nirspec_anomaly' - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/cosmic_ray.py b/jwql/website/apps/jwql/monitor_models/cosmic_ray.py index aa0ae499b..cdff2eb22 100644 --- a/jwql/website/apps/jwql/monitor_models/cosmic_ray.py +++ b/jwql/website/apps/jwql/monitor_models/cosmic_ray.py @@ -43,7 +43,6 @@ class Meta: managed = True db_table = 'fgs_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSCosmicRayStats(models.Model): @@ -61,7 +60,6 @@ class Meta: managed = True db_table = 'fgs_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRICosmicRayQueryHistory(models.Model): @@ -77,7 +75,6 @@ class Meta: managed = True db_table = 'miri_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRICosmicRayStats(models.Model): @@ -95,7 +92,6 @@ class Meta: managed = True db_table = 'miri_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamCosmicRayQueryHistory(models.Model): @@ -111,7 +107,6 @@ class Meta: managed = True db_table = 'nircam_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamCosmicRayStats(models.Model): @@ -129,7 +124,6 @@ class Meta: managed = True db_table = 'nircam_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSCosmicRayQueryHistory(models.Model): @@ -145,7 +139,6 @@ class Meta: managed = True db_table = 'niriss_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSCosmicRayStats(models.Model): @@ -163,7 +156,6 @@ class Meta: managed = True db_table = 'niriss_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecCosmicRayQueryHistory(models.Model): @@ -179,7 +171,6 @@ class Meta: managed = True db_table = 'nirspec_cosmic_ray_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecCosmicRayStats(models.Model): @@ -197,4 +188,3 @@ class Meta: managed = True db_table = 'nirspec_cosmic_ray_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/dark_current.py b/jwql/website/apps/jwql/monitor_models/dark_current.py index cfb1a595f..41ae1ccac 100644 --- a/jwql/website/apps/jwql/monitor_models/dark_current.py +++ b/jwql/website/apps/jwql/monitor_models/dark_current.py @@ -60,7 +60,6 @@ class Meta: managed = True db_table = 'fgs_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSDarkPixelStats(models.Model): @@ -80,7 +79,6 @@ class Meta: managed = True db_table = 'fgs_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSDarkQueryHistory(models.Model): @@ -97,7 +95,6 @@ class Meta: managed = True db_table = 'fgs_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIDarkDarkCurrent(models.Model): @@ -130,7 +127,6 @@ class Meta: managed = True db_table = 'miri_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIDarkPixelStats(models.Model): @@ -150,7 +146,6 @@ class Meta: managed = True db_table = 'miri_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIDarkQueryHistory(models.Model): @@ -167,7 +162,6 @@ class Meta: managed = True db_table = 'miri_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamDarkDarkCurrent(models.Model): @@ -200,7 +194,6 @@ class Meta: managed = True db_table = 'nircam_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamDarkPixelStats(models.Model): @@ -220,7 +213,6 @@ class Meta: managed = True db_table = 'nircam_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamDarkQueryHistory(models.Model): @@ -237,7 +229,6 @@ class Meta: managed = True db_table = 'nircam_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSDarkDarkCurrent(models.Model): @@ -270,7 +261,6 @@ class Meta: managed = True db_table = 'niriss_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSDarkPixelStats(models.Model): @@ -290,7 +280,6 @@ class Meta: managed = True db_table = 'niriss_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSDarkQueryHistory(models.Model): @@ -307,7 +296,6 @@ class Meta: managed = True db_table = 'niriss_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecDarkDarkCurrent(models.Model): @@ -340,7 +328,6 @@ class Meta: managed = True db_table = 'nirspec_dark_dark_current' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecDarkPixelStats(models.Model): @@ -360,7 +347,6 @@ class Meta: managed = True db_table = 'nirspec_dark_pixel_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecDarkQueryHistory(models.Model): @@ -377,4 +363,3 @@ class Meta: managed = True db_table = 'nirspec_dark_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/edb.py b/jwql/website/apps/jwql/monitor_models/edb.py index c9996c23c..2cad15418 100644 --- a/jwql/website/apps/jwql/monitor_models/edb.py +++ b/jwql/website/apps/jwql/monitor_models/edb.py @@ -45,7 +45,6 @@ class Meta: managed = True db_table = 'fgs_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSEdbDailyStats(models.Model): @@ -63,7 +62,6 @@ class Meta: managed = True db_table = 'fgs_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSEdbEveryChangeStats(models.Model): @@ -81,7 +79,6 @@ class Meta: managed = True db_table = 'fgs_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSEdbTimeIntervalStats(models.Model): @@ -99,7 +96,6 @@ class Meta: managed = True db_table = 'fgs_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSEdbTimeStats(models.Model): @@ -114,7 +110,6 @@ class Meta: managed = True db_table = 'fgs_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIEdbBlocksStats(models.Model): @@ -132,7 +127,6 @@ class Meta: managed = True db_table = 'miri_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIEdbDailyStats(models.Model): @@ -150,7 +144,6 @@ class Meta: managed = True db_table = 'miri_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIEdbEveryChangeStats(models.Model): @@ -168,7 +161,6 @@ class Meta: managed = True db_table = 'miri_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIEdbTimeIntervalStats(models.Model): @@ -186,7 +178,6 @@ class Meta: managed = True db_table = 'miri_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIEdbTimeStats(models.Model): @@ -201,7 +192,6 @@ class Meta: managed = True db_table = 'miri_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamEdbBlocksStats(models.Model): @@ -219,7 +209,6 @@ class Meta: managed = True db_table = 'nircam_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamEdbDailyStats(models.Model): @@ -237,7 +226,6 @@ class Meta: managed = True db_table = 'nircam_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamEdbEveryChangeStats(models.Model): @@ -255,7 +243,6 @@ class Meta: managed = True db_table = 'nircam_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamEdbTimeIntervalStats(models.Model): @@ -273,7 +260,6 @@ class Meta: managed = True db_table = 'nircam_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamEdbTimeStats(models.Model): @@ -288,7 +274,6 @@ class Meta: managed = True db_table = 'nircam_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSEdbBlocksStats(models.Model): @@ -306,7 +291,6 @@ class Meta: managed = True db_table = 'niriss_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSEdbDailyStats(models.Model): @@ -324,7 +308,6 @@ class Meta: managed = True db_table = 'niriss_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSEdbEveryChangeStats(models.Model): @@ -342,7 +325,6 @@ class Meta: managed = True db_table = 'niriss_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSEdbTimeIntervalStats(models.Model): @@ -360,7 +342,6 @@ class Meta: managed = True db_table = 'niriss_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSEdbTimeStats(models.Model): @@ -375,7 +356,6 @@ class Meta: managed = True db_table = 'niriss_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecEdbBlocksStats(models.Model): @@ -393,7 +373,6 @@ class Meta: managed = True db_table = 'nirspec_edb_blocks_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecEdbDailyStats(models.Model): @@ -411,7 +390,6 @@ class Meta: managed = True db_table = 'nirspec_edb_daily_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecEdbEveryChangeStats(models.Model): @@ -429,7 +407,6 @@ class Meta: managed = True db_table = 'nirspec_edb_every_change_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecEdbTimeIntervalStats(models.Model): @@ -447,7 +424,6 @@ class Meta: managed = True db_table = 'nirspec_edb_time_interval_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecEdbTimeStats(models.Model): @@ -462,4 +438,3 @@ class Meta: managed = True db_table = 'nirspec_edb_time_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/grating.py b/jwql/website/apps/jwql/monitor_models/grating.py index ac0e13ab5..1c2029049 100644 --- a/jwql/website/apps/jwql/monitor_models/grating.py +++ b/jwql/website/apps/jwql/monitor_models/grating.py @@ -40,7 +40,6 @@ class Meta: managed = True db_table = 'nirspec_grating_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecGratingStats(models.Model): @@ -70,4 +69,3 @@ class Meta: managed = True db_table = 'nirspec_grating_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/readnoise.py b/jwql/website/apps/jwql/monitor_models/readnoise.py index a9e3537b4..5e616aa71 100644 --- a/jwql/website/apps/jwql/monitor_models/readnoise.py +++ b/jwql/website/apps/jwql/monitor_models/readnoise.py @@ -44,7 +44,6 @@ class Meta: managed = True db_table = 'fgs_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class FGSReadnoiseStats(models.Model): @@ -88,7 +87,6 @@ class Meta: managed = True db_table = 'fgs_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIReadnoiseQueryHistory(models.Model): @@ -105,7 +103,6 @@ class Meta: managed = True db_table = 'miri_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRIReadnoiseStats(models.Model): @@ -149,7 +146,6 @@ class Meta: managed = True db_table = 'miri_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamReadnoiseQueryHistory(models.Model): @@ -166,7 +162,6 @@ class Meta: managed = True db_table = 'nircam_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRCamReadnoiseStats(models.Model): @@ -210,7 +205,6 @@ class Meta: managed = True db_table = 'nircam_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSReadnoiseQueryHistory(models.Model): @@ -227,7 +221,6 @@ class Meta: managed = True db_table = 'niriss_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRISSReadnoiseStats(models.Model): @@ -271,7 +264,6 @@ class Meta: managed = True db_table = 'niriss_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecReadnoiseQueryHistory(models.Model): @@ -288,7 +280,6 @@ class Meta: managed = True db_table = 'nirspec_readnoise_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecReadnoiseStats(models.Model): @@ -332,4 +323,3 @@ class Meta: managed = True db_table = 'nirspec_readnoise_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/monitor_models/ta.py b/jwql/website/apps/jwql/monitor_models/ta.py index e9730d7ab..93a8b269b 100644 --- a/jwql/website/apps/jwql/monitor_models/ta.py +++ b/jwql/website/apps/jwql/monitor_models/ta.py @@ -44,7 +44,6 @@ class Meta: managed = True db_table = 'miri_ta_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class MIRITaStats(models.Model): @@ -63,7 +62,6 @@ class Meta: managed = True db_table = 'miri_ta_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecTaQueryHistory(models.Model): @@ -80,7 +78,6 @@ class Meta: managed = True db_table = 'nirspec_ta_query_history' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' class NIRSpecTaStats(models.Model): @@ -122,4 +119,3 @@ class Meta: managed = True db_table = 'nirspec_ta_stats' unique_together = (('id', 'entry_date'),) - db_table_comment = 'monitors' diff --git a/jwql/website/apps/jwql/router.py b/jwql/website/apps/jwql/router.py new file mode 100644 index 000000000..1baff7b8c --- /dev/null +++ b/jwql/website/apps/jwql/router.py @@ -0,0 +1,65 @@ +"""Defines the query routing for the monitor database tables. + +In Django, database queries are assumed to go to the default database unless either the +`using` field/keyword is defined or a routing table sends it to a different database. In +this case, all monitor tables should be routed to the monitors database, and the router +should otherwise express no opinion (by returning None). + +Authors +------- + - Brian York + +Use +--- + This module is not intended to be used outside of Django asking about it. + +References +---------- + For more information please see: + ```https://docs.djangoproject.com/en/2.0/topics/db/models/``` +""" +from jwql.utils.constants import MONITOR_TABLE_NAMES + + +class MonitorRouter: + """ + A router to control all database operations on models in the + JWQLDB (monitors) database. + """ + + route_app_labels = {"monitors"} + + def db_for_read(self, model, **hints): + """ + Attempts to read monitor models go to monitors db. + """ + if model.__name__ in MONITOR_TABLE_NAMES: + return "monitors" + return None + + def db_for_write(self, model, **hints): + """ + Attempts to write monitor models go to monitors db. + """ + if model.__name__ in MONITOR_TABLE_NAMES: + return "monitors" + return None + + def allow_relation(self, obj1, obj2, **hints): + """ + Allow relations between tables in the monitors DB. + """ + if ( + obj1.__class__.__name__ in MONITOR_TABLE_NAMES + or obj2.__class__.__name__ in MONITOR_TABLE_NAMES + ): + return True + return None + + def allow_migrate(self, db, app_label, model_name=None, **hints): + """ + Make sure the monitors apps only appear in the 'monitors' database. + """ + if app_label in self.route_app_labels or app_label == 'jwql': + return db == "monitors" + return None diff --git a/jwql/website/jwql_proj/settings.py b/jwql/website/jwql_proj/settings.py index c0e72240f..a8adf9fa3 100644 --- a/jwql/website/jwql_proj/settings.py +++ b/jwql/website/jwql_proj/settings.py @@ -111,7 +111,7 @@ 'default': get_config()['django_databases']['default'], 'monitors': get_config()['django_databases']['monitors'] } -DATABASE_ROUTERS = ["jwql.website.apps.jwql.monitor_models.common.MonitorRouter"] +DATABASE_ROUTERS = ["jwql.website.apps.jwql.router.MonitorRouter"] # Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators From d857c811c6ffa0ed8b0687d78796ff89b009d024 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 14:53:07 -0500 Subject: [PATCH 10/16] Added reverse functions so migrations could be undone --- ...nomaly_filesystemcharacteristics_and_more.py | 5 ++++- .../migrations/0019_add_claw_table_fields.py | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py index 9f69ebd72..265aae8e8 100644 --- a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py +++ b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py @@ -610,6 +610,9 @@ def db_select(apps, schema_editor): }, ) +def reverse_migration(apps, schema_editor): + return + class Migration(migrations.Migration): @@ -618,5 +621,5 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython(db_select), + migrations.RunPython(db_select, reverse_migration), ] diff --git a/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py b/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py index 2aa24a938..43cd1db2d 100644 --- a/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py +++ b/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py @@ -22,6 +22,21 @@ def db_select(apps, schema_editor): ) +def reverse_migration(apps, schema_editor): + if schema_editor.connection.alias == "default": + # Anything that's not for the monitors tables + return + else: + migrations.RemoveField( + model_name='nircam_claw_stats', + name='doy', + ) + migrations.RemoveField( + model_name='nircam_claw_stats', + name='total_bkg', + ) + + class Migration(migrations.Migration): dependencies = [ @@ -29,5 +44,5 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython(db_select), + migrations.RunPython(db_select, reverse_migration), ] From c0072407524bc93fc521ea0548a2654f2214c85c Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 14:54:11 -0500 Subject: [PATCH 11/16] Removed migration files after having reverted migrations --- ...maly_filesystemcharacteristics_and_more.py | 625 ------------------ ...maly_filesystemcharacteristics_and_more.py | 612 ----------------- .../migrations/0019_add_claw_table_fields.py | 48 -- ...clawstats_doy_nircamclawstats_total_bkg.py | 23 - 4 files changed, 1308 deletions(-) delete mode 100644 jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py delete mode 100644 jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py delete mode 100644 jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py delete mode 100644 jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py diff --git a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py b/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py deleted file mode 100644 index 265aae8e8..000000000 --- a/jwql/website/apps/jwql/migrations/0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py +++ /dev/null @@ -1,625 +0,0 @@ -# Generated by Django 4.2.5 on 2024-02-20 20:04 - -import django.contrib.postgres.fields -from django.db import migrations, models -import sys - - -def db_select(apps, schema_editor): - sys.stderr.write("\napps: {}, schema_editor: {}, schema_editor.connection.alias: {}\n".format(apps, schema_editor, schema_editor.connections.alias)) - if schema_editor.connection.alias == "default": - # Anything that's not for the monitors tables - return - else: - migrations.CreateModel( - name='CentralStorage', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('area', models.CharField()), - ('size', models.FloatField()), - ('used', models.FloatField()), - ('available', models.FloatField()), - ], - options={ - 'db_table': 'central_storage', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='FgsAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('other', models.BooleanField()), - ], - options={ - 'db_table': 'fgs_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='FilesystemCharacteristics', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('instrument', models.TextField()), - ('filter_pupil', models.TextField(blank=True, null=True)), - ('obs_per_filter_pupil', models.TextField(blank=True, null=True)), - ], - options={ - 'db_table': 'filesystem_characteristics', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='FilesystemGeneral', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField(unique=True)), - ('total_file_count', models.IntegerField()), - ('total_file_size', models.FloatField()), - ('fits_file_count', models.IntegerField()), - ('fits_file_size', models.FloatField()), - ('used', models.FloatField()), - ('available', models.FloatField()), - ], - options={ - 'db_table': 'filesystem_general', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='MiriAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('column_pull_up', models.BooleanField()), - ('internal_reflection', models.BooleanField()), - ('row_pull_down', models.BooleanField()), - ('other', models.BooleanField()), - ('column_pull_down', models.BooleanField()), - ('mrs_glow', models.BooleanField(db_column='MRS_Glow')), - ('mrs_zipper', models.BooleanField(db_column='MRS_Zipper')), - ('row_pull_up', models.BooleanField()), - ('lrs_contamination', models.BooleanField(db_column='LRS_Contamination')), - ('tree_rings', models.BooleanField()), - ], - options={ - 'db_table': 'miri_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='Monitor', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('monitor_name', models.CharField()), - ('start_time', models.DateTimeField()), - ('end_time', models.DateTimeField(blank=True, null=True)), - ('status', models.TextField(blank=True, null=True)), - ('log_file', models.CharField()), - ], - options={ - 'db_table': 'monitor', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='NircamAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('dragons_breath', models.BooleanField()), - ('other', models.BooleanField()), - ('scattered_light', models.BooleanField()), - ('claws', models.BooleanField()), - ('wisps', models.BooleanField()), - ('tilt_event', models.BooleanField()), - ], - options={ - 'db_table': 'nircam_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='NirissAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('other', models.BooleanField()), - ('scattered_light', models.TextField()), - ('light_saber', models.TextField()), - ], - options={ - 'db_table': 'niriss_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='NirspecAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('dominant_msa_leakage', models.BooleanField(db_column='Dominant_MSA_Leakage')), - ('optical_short', models.BooleanField()), - ('other', models.BooleanField()), - ], - options={ - 'db_table': 'nirspec_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ) - migrations.CreateModel( - name='NIRSpecReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'nirspec_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRSpecReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'nirspec_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRISSReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'niriss_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRISSReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'niriss_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRCamReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'nircam_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRCamReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'nircam_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRCamClawStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('filename', models.CharField(blank=True, null=True)), - ('proposal', models.CharField(blank=True, null=True)), - ('obs', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('filter', models.CharField(blank=True, null=True)), - ('pupil', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('expstart_mjd', models.FloatField(blank=True, null=True)), - ('effexptm', models.FloatField(blank=True, null=True)), - ('ra', models.FloatField(blank=True, null=True)), - ('dec', models.FloatField(blank=True, null=True)), - ('pa_v3', models.FloatField(blank=True, null=True)), - ('mean', models.FloatField(blank=True, null=True)), - ('median', models.FloatField(blank=True, null=True)), - ('stddev', models.FloatField(blank=True, null=True)), - ('frac_masked', models.FloatField(blank=True, null=True)), - ('skyflat_filename', models.CharField(blank=True, null=True)), - ], - options={ - 'db_table': 'nircam_claw_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='NIRCamClawQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('instrument', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ], - options={ - 'db_table': 'nircam_claw_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='MIRIReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'miri_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='MIRIReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'miri_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='FilesystemInstrument', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('instrument', models.TextField()), - ('filetype', models.TextField()), - ('count', models.IntegerField()), - ('size', models.FloatField()), - ], - options={ - 'db_table': 'filesystem_instrument', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('date', 'instrument', 'filetype')}, - }, - ) - migrations.CreateModel( - name='FGSReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'fgs_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - migrations.CreateModel( - name='FGSReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'fgs_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ) - -def reverse_migration(apps, schema_editor): - return - - -class Migration(migrations.Migration): - - dependencies = [ - ('jwql', '0016_anomalies_bright_object_not_a_short_and_more'), - ] - - operations = [ - migrations.RunPython(db_select, reverse_migration), - ] diff --git a/jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py b/jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py deleted file mode 100644 index 6f50409cd..000000000 --- a/jwql/website/apps/jwql/migrations/0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more.py +++ /dev/null @@ -1,612 +0,0 @@ -# Generated by Django 4.2.5 on 2024-02-20 20:19 - -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('jwql', '0017_centralstorage_fgsanomaly_filesystemcharacteristics_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='CentralStorage', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('area', models.CharField()), - ('size', models.FloatField()), - ('used', models.FloatField()), - ('available', models.FloatField()), - ], - options={ - 'db_table': 'central_storage', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='FgsAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('other', models.BooleanField()), - ], - options={ - 'db_table': 'fgs_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='FilesystemCharacteristics', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('instrument', models.TextField()), - ('filter_pupil', models.TextField(blank=True, null=True)), - ('obs_per_filter_pupil', models.TextField(blank=True, null=True)), - ], - options={ - 'db_table': 'filesystem_characteristics', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='FilesystemGeneral', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField(unique=True)), - ('total_file_count', models.IntegerField()), - ('total_file_size', models.FloatField()), - ('fits_file_count', models.IntegerField()), - ('fits_file_size', models.FloatField()), - ('used', models.FloatField()), - ('available', models.FloatField()), - ], - options={ - 'db_table': 'filesystem_general', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='MiriAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('column_pull_up', models.BooleanField()), - ('internal_reflection', models.BooleanField()), - ('row_pull_down', models.BooleanField()), - ('other', models.BooleanField()), - ('column_pull_down', models.BooleanField()), - ('mrs_glow', models.BooleanField(db_column='MRS_Glow')), - ('mrs_zipper', models.BooleanField(db_column='MRS_Zipper')), - ('row_pull_up', models.BooleanField()), - ('lrs_contamination', models.BooleanField(db_column='LRS_Contamination')), - ('tree_rings', models.BooleanField()), - ], - options={ - 'db_table': 'miri_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='Monitor', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('monitor_name', models.CharField()), - ('start_time', models.DateTimeField()), - ('end_time', models.DateTimeField(blank=True, null=True)), - ('status', models.TextField(blank=True, null=True)), - ('log_file', models.CharField()), - ], - options={ - 'db_table': 'monitor', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='NircamAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('dragons_breath', models.BooleanField()), - ('other', models.BooleanField()), - ('scattered_light', models.BooleanField()), - ('claws', models.BooleanField()), - ('wisps', models.BooleanField()), - ('tilt_event', models.BooleanField()), - ], - options={ - 'db_table': 'nircam_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='NirissAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('other', models.BooleanField()), - ('scattered_light', models.TextField()), - ('light_saber', models.TextField()), - ], - options={ - 'db_table': 'niriss_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='NirspecAnomaly', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('rootname', models.CharField()), - ('flag_date', models.DateTimeField()), - ('user', models.CharField()), - ('cosmic_ray_shower', models.BooleanField()), - ('diffraction_spike', models.BooleanField()), - ('excessive_saturation', models.BooleanField()), - ('guidestar_failure', models.BooleanField()), - ('persistence', models.BooleanField()), - ('crosstalk', models.BooleanField()), - ('data_transfer_error', models.BooleanField()), - ('ghost', models.BooleanField()), - ('snowball', models.BooleanField()), - ('dominant_msa_leakage', models.BooleanField(db_column='Dominant_MSA_Leakage')), - ('optical_short', models.BooleanField()), - ('other', models.BooleanField()), - ], - options={ - 'db_table': 'nirspec_anomaly', - 'db_table_comment': 'monitors', - 'managed': True, - }, - ), - migrations.CreateModel( - name='NIRSpecReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'nirspec_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRSpecReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'nirspec_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRISSReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'niriss_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRISSReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'niriss_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRCamReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'nircam_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRCamReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'nircam_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRCamClawStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('filename', models.CharField(blank=True, null=True)), - ('proposal', models.CharField(blank=True, null=True)), - ('obs', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('filter', models.CharField(blank=True, null=True)), - ('pupil', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('expstart_mjd', models.FloatField(blank=True, null=True)), - ('effexptm', models.FloatField(blank=True, null=True)), - ('ra', models.FloatField(blank=True, null=True)), - ('dec', models.FloatField(blank=True, null=True)), - ('pa_v3', models.FloatField(blank=True, null=True)), - ('mean', models.FloatField(blank=True, null=True)), - ('median', models.FloatField(blank=True, null=True)), - ('stddev', models.FloatField(blank=True, null=True)), - ('frac_masked', models.FloatField(blank=True, null=True)), - ('skyflat_filename', models.CharField(blank=True, null=True)), - ], - options={ - 'db_table': 'nircam_claw_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='NIRCamClawQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('instrument', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ], - options={ - 'db_table': 'nircam_claw_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='MIRIReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'miri_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='MIRIReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'miri_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='FilesystemInstrument', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('instrument', models.TextField()), - ('filetype', models.TextField()), - ('count', models.IntegerField()), - ('size', models.FloatField()), - ], - options={ - 'db_table': 'filesystem_instrument', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('date', 'instrument', 'filetype')}, - }, - ), - migrations.CreateModel( - name='FGSReadnoiseStats', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uncal_filename', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('detector', models.CharField(blank=True, null=True)), - ('subarray', models.CharField(blank=True, null=True)), - ('read_pattern', models.CharField(blank=True, null=True)), - ('nints', models.CharField(blank=True, null=True)), - ('ngroups', models.CharField(blank=True, null=True)), - ('expstart', models.CharField(blank=True, null=True)), - ('readnoise_filename', models.CharField(blank=True, null=True)), - ('full_image_mean', models.FloatField(blank=True, null=True)), - ('full_image_stddev', models.FloatField(blank=True, null=True)), - ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('readnoise_diff_image', models.CharField(blank=True, null=True)), - ('diff_image_mean', models.FloatField(blank=True, null=True)), - ('diff_image_stddev', models.FloatField(blank=True, null=True)), - ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ('amp1_mean', models.FloatField(blank=True, null=True)), - ('amp1_stddev', models.FloatField(blank=True, null=True)), - ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_mean', models.FloatField(blank=True, null=True)), - ('amp2_stddev', models.FloatField(blank=True, null=True)), - ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_mean', models.FloatField(blank=True, null=True)), - ('amp3_stddev', models.FloatField(blank=True, null=True)), - ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_mean', models.FloatField(blank=True, null=True)), - ('amp4_stddev', models.FloatField(blank=True, null=True)), - ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), - ], - options={ - 'db_table': 'fgs_readnoise_stats', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - migrations.CreateModel( - name='FGSReadnoiseQueryHistory', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('instrument', models.CharField(blank=True, null=True)), - ('aperture', models.CharField(blank=True, null=True)), - ('start_time_mjd', models.FloatField(blank=True, null=True)), - ('end_time_mjd', models.FloatField(blank=True, null=True)), - ('entries_found', models.IntegerField(blank=True, null=True)), - ('files_found', models.IntegerField(blank=True, null=True)), - ('run_monitor', models.BooleanField(blank=True, null=True)), - ('entry_date', models.DateTimeField(blank=True, null=True)), - ], - options={ - 'db_table': 'fgs_readnoise_query_history', - 'db_table_comment': 'monitors', - 'managed': True, - 'unique_together': {('id', 'entry_date')}, - }, - ), - ] diff --git a/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py b/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py deleted file mode 100644 index 43cd1db2d..000000000 --- a/jwql/website/apps/jwql/migrations/0019_add_claw_table_fields.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 4.2.5 on 2024-02-20 20:04 - -import django.contrib.postgres.fields -from django.db import migrations, models -import sys - - -def db_select(apps, schema_editor): - if schema_editor.connection.alias == "default": - # Anything that's not for the monitors tables - return - else: - migrations.AddField( - model_name='nircam_claw_stats', - name='doy', - field=models.FloatField(blank=True, null=True), - ) - migrations.AddField( - model_name='nircam_claw_stats', - name='total_bkg', - field=models.FloatField(blank=True, null=True), - ) - - -def reverse_migration(apps, schema_editor): - if schema_editor.connection.alias == "default": - # Anything that's not for the monitors tables - return - else: - migrations.RemoveField( - model_name='nircam_claw_stats', - name='doy', - ) - migrations.RemoveField( - model_name='nircam_claw_stats', - name='total_bkg', - ) - - -class Migration(migrations.Migration): - - dependencies = [ - ('jwql', '0018_centralstorage_fgsanomaly_filesystemcharacteristics_and_more'), - ] - - operations = [ - migrations.RunPython(db_select, reverse_migration), - ] diff --git a/jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py b/jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py deleted file mode 100644 index 974af312a..000000000 --- a/jwql/website/apps/jwql/migrations/0020_nircamclawstats_doy_nircamclawstats_total_bkg.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.2.5 on 2024-02-20 20:31 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('jwql', '0019_add_claw_table_fields'), - ] - - operations = [ - migrations.AddField( - model_name='nircamclawstats', - name='doy', - field=models.FloatField(blank=True, null=True), - ), - migrations.AddField( - model_name='nircamclawstats', - name='total_bkg', - field=models.FloatField(blank=True, null=True), - ), - ] From 0f0681da219e837b7af3fbc6829b684d8ed01c50 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 14:57:24 -0500 Subject: [PATCH 12/16] Updated formatting on common model documentation --- .../apps/jwql/monitor_models/common.py | 228 +++++++++--------- 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/jwql/website/apps/jwql/monitor_models/common.py b/jwql/website/apps/jwql/monitor_models/common.py index 5114e641a..d0bed2afc 100644 --- a/jwql/website/apps/jwql/monitor_models/common.py +++ b/jwql/website/apps/jwql/monitor_models/common.py @@ -8,153 +8,153 @@ a data table. This module defines models that are used to store data related to the JWQL monitors. -Usage ------ + Usage + ----- -JWQL uses the django database models for creating tables, updating table fields, adding -new data to tables, and retrieving data from tables. For instrument monitors, in particular, -there are a number of issues that may be relevant. + JWQL uses the django database models for creating tables, updating table fields, adding + new data to tables, and retrieving data from tables. For instrument monitors, in particular, + there are a number of issues that may be relevant. -In general, django model documentation can be found -`on the django website `_. -Unfortunately, finding a particular bit of documentation in django can be a challenge, so -a few quick-reference notes are provided below. + In general, django model documentation can be found + `on the django website `_. + Unfortunately, finding a particular bit of documentation in django can be a challenge, so + a few quick-reference notes are provided below. -Retrieving Data ---------------- + Retrieving Data + --------------- -Django retrieves data directly from its model tables. So, for example, if you want to -select data from the `MIRIMyMonitorStats` table, you must first import the relevant -object: + Django retrieves data directly from its model tables. So, for example, if you want to + select data from the `MIRIMyMonitorStats` table, you must first import the relevant + object: -.. code-block:: python + .. code-block:: python - from jwql.website.apps.jwql.monitor_models.my_monitor import MIRIMyMonitorStats + from jwql.website.apps.jwql.monitor_models.my_monitor import MIRIMyMonitorStats -Then, you would access the database contents via the `objects` member of the class. For -example, to search the `MIRIMyMonitorStats` table for all entries matching a given -aperture, and to sort them with the most recent date at the top, you might do a query like -the following: + Then, you would access the database contents via the `objects` member of the class. For + example, to search the `MIRIMyMonitorStats` table for all entries matching a given + aperture, and to sort them with the most recent date at the top, you might do a query like + the following: -.. code-block:: python + .. code-block:: python - aperture = "my_miri_aperture" + aperture = "my_miri_aperture" - records = MIRIMyMonitorStats.objects.filter(aperture__iexact=aperture).order_by("-mjd_end").all() + records = MIRIMyMonitorStats.objects.filter(aperture__iexact=aperture).order_by("-mjd_end").all() -In the above code, + In the above code, -* The `filter()` function selects matching records from the full table. You can use - multiple filter statements, or a single filter function with multiple filters. `filter()` - statements are always combined with an implicit AND. -* If you have a long filter statement and want to separate it from the query statement, - you can create a dictionary and add it in with the `**` prepended. The dictionary - equivalent to the above would be `{'aperture__iexact': aperture}` -* The text before the double underscore is a field name, and the text afterwards describes - the type of comparison. `iexact` indicates "case-insensitive exact match". You can also - use a variety of standard SQL comparisons (`like`, `startswith`, `gte`, etc.) -* If you want to get only records that *don't* match a pattern, then you can use the - `exclude()` function, which otherwise operates exactly the same as `filter()`. -* In the `order_by()` function, the `-` at the start is used to reverse the sort order, - and the `mjd_end` is the name of the field to be sorted by. -* The `all()` statement indicates that you want all the values returned. `get()` returns - a single value and can be iterated on, `first()` returns only the first value, etc. + * The `filter()` function selects matching records from the full table. You can use + multiple filter statements, or a single filter function with multiple filters. `filter()` + statements are always combined with an implicit AND. + * If you have a long filter statement and want to separate it from the query statement, + you can create a dictionary and add it in with the `**` prepended. The dictionary + equivalent to the above would be `{'aperture__iexact': aperture}` + * The text before the double underscore is a field name, and the text afterwards describes + the type of comparison. `iexact` indicates "case-insensitive exact match". You can also + use a variety of standard SQL comparisons (`like`, `startswith`, `gte`, etc.) + * If you want to get only records that *don't* match a pattern, then you can use the + `exclude()` function, which otherwise operates exactly the same as `filter()`. + * In the `order_by()` function, the `-` at the start is used to reverse the sort order, + and the `mjd_end` is the name of the field to be sorted by. + * The `all()` statement indicates that you want all the values returned. `get()` returns + a single value and can be iterated on, `first()` returns only the first value, etc. -As an example of multiple filters, the code below: + As an example of multiple filters, the code below: -.. code-block:: python + .. code-block:: python - records = MIRIMyMonitorStats.objects.filter(aperture__iexact=ap, mjd_end__gte=60000) + records = MIRIMyMonitorStats.objects.filter(aperture__iexact=ap, mjd_end__gte=60000) - filters = { - "aperture__iexact": ap, - "mjd_end__gte": 60000 - } - records = MIRIMyMonitorStats.objects.filter(**filters) + filters = { + "aperture__iexact": ap, + "mjd_end__gte": 60000 + } + records = MIRIMyMonitorStats.objects.filter(**filters) -show two different ways of combining a search for a particular aperture *and* only data -taken more recently than MJD=60000. + show two different ways of combining a search for a particular aperture *and* only data + taken more recently than MJD=60000. -Note that django executes queries lazily, meaning that it will only actually *do* the -query when it needs the results. The above statement, for example, will not actually -run the query. Instead, it will be run when you operate on it, such as + Note that django executes queries lazily, meaning that it will only actually *do* the + query when it needs the results. The above statement, for example, will not actually + run the query. Instead, it will be run when you operate on it, such as -* Getting the length of the result with e.g. `len(records)` -* Printing out any of the results -* Asking for the value of one of the fields (e.g. `records[3].aperture`) + * Getting the length of the result with e.g. `len(records)` + * Printing out any of the results + * Asking for the value of one of the fields (e.g. `records[3].aperture`) -Retrieving Specific Columns -=========================== + Retrieving Specific Columns + =========================== -Django offers two ways of doing this. The first one is to use the `only()` function, which -immediately loads only the relevant columns. For example, + Django offers two ways of doing this. The first one is to use the `only()` function, which + immediately loads only the relevant columns. For example, -.. code-block:: python + .. code-block:: python - records = MIRIMyMonitorStats.objects.only("aperture", "mjd_start", "relevant_item") + records = MIRIMyMonitorStats.objects.only("aperture", "mjd_start", "relevant_item") -will immediately load only the three columns selected (although the rest will be retrieved -from the database, and can still be accessed, for no immediately understandable reason). -The other method is the `defer()` method, which loads every column *except* the ones listed. + will immediately load only the three columns selected (although the rest will be retrieved + from the database, and can still be accessed, for no immediately understandable reason). + The other method is the `defer()` method, which loads every column *except* the ones listed. -Q Objects -========= + Q Objects + ========= -In order to make more complex queries, Django supplies "Q Objects", which are essentially -encapsulated filters which can be combined using logical operators. For more on this, see -`the django Q object documentation `_. + In order to make more complex queries, Django supplies "Q Objects", which are essentially + encapsulated filters which can be combined using logical operators. For more on this, see + `the django Q object documentation `_. -Storing Data ------------- + Storing Data + ------------ -Django also uses the model tables (and objects) directly for storing new data. For example, -if you have a monitor table defined as below: + Django also uses the model tables (and objects) directly for storing new data. For example, + if you have a monitor table defined as below: -.. code-block:: python + .. code-block:: python - from django.db import models - from django.contrib.postgres.fields import ArrayField + from django.db import models + from django.contrib.postgres.fields import ArrayField - class NIRISSMyMonitorStats(models.Model): - aperture = models.CharField(blank=True, null=True) - mean = models.FloatField(blank=True, null=True) - median = models.FloatField(blank=True, null=True) - stddev = models.FloatField(blank=True, null=True) - counts = ArrayField(models.FloatField()) - entry_date = models.DateTimeField(blank=True, null=True) + class NIRISSMyMonitorStats(models.Model): + aperture = models.CharField(blank=True, null=True) + mean = models.FloatField(blank=True, null=True) + median = models.FloatField(blank=True, null=True) + stddev = models.FloatField(blank=True, null=True) + counts = ArrayField(models.FloatField()) + entry_date = models.DateTimeField(blank=True, null=True) - class Meta: - managed = True - db_table = 'niriss_my_monitor_stats' - unique_together = (('id', 'entry_date'),) - -then you would create a new entry as follows: + class Meta: + managed = True + db_table = 'niriss_my_monitor_stats' + unique_together = (('id', 'entry_date'),) -.. code-block:: python - - values = { - "aperture": "my_aperture", - "mean": float(mean), - "median": float(median), - "stddev": float(stddev), - "counts": list(counts.astype(float)), - "entry_date": datetime.datetime.now() - } - - entry = NIRISSMyMonitorStats(**values) - entry.save() - -There are (as usual) a few things to note above: - -* Django doesn't have a built-in array data type, so you need to import it from the - database-compatibility layers. The ArrayField takes, as a required argument, the type - of data that makes up the array. -* In the Meta sub-class of the monitor class, the `db_table_comment = 'monitors'` statement is - required so that django knows that the model should be stored in the monitors table. -* The `float()` casts are required because the database interface doesn't understand - numpy data types. -* The `list()` cast is required because the database interface doesn't understand the - numpy `ndarray` data type + then you would create a new entry as follows: + + .. code-block:: python + + values = { + "aperture": "my_aperture", + "mean": float(mean), + "median": float(median), + "stddev": float(stddev), + "counts": list(counts.astype(float)), + "entry_date": datetime.datetime.now() + } + + entry = NIRISSMyMonitorStats(**values) + entry.save() + + There are (as usual) a few things to note above: + + * Django doesn't have a built-in array data type, so you need to import it from the + database-compatibility layers. The ArrayField takes, as a required argument, the type + of data that makes up the array. + * In the Meta sub-class of the monitor class, the `db_table_comment = 'monitors'` statement is + required so that django knows that the model should be stored in the monitors table. + * The `float()` casts are required because the database interface doesn't understand + numpy data types. + * The `list()` cast is required because the database interface doesn't understand the + numpy `ndarray` data type Authors ------- From c08ce8c593a66d107e48de72e87520a92755e49f Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 15:01:56 -0500 Subject: [PATCH 13/16] Temporarily removed fields from claw model since migration had been reverted --- jwql/website/apps/jwql/monitor_models/claw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jwql/website/apps/jwql/monitor_models/claw.py b/jwql/website/apps/jwql/monitor_models/claw.py index a1c6c93e3..cc327ddfa 100644 --- a/jwql/website/apps/jwql/monitor_models/claw.py +++ b/jwql/website/apps/jwql/monitor_models/claw.py @@ -61,8 +61,8 @@ class NIRCamClawStats(models.Model): stddev = models.FloatField(blank=True, null=True) frac_masked = models.FloatField(blank=True, null=True) skyflat_filename = models.CharField(blank=True, null=True) - doy = models.FloatField(blank=True, null=True) - total_bkg = models.FloatField(blank=True, null=True) +# doy = models.FloatField(blank=True, null=True) +# total_bkg = models.FloatField(blank=True, null=True) class Meta: managed = True From adf110a376bd1d4d6770bd9672871de73c2ec515 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 16:21:52 -0500 Subject: [PATCH 14/16] made migrations for monitor tables and adding claw monitor columns --- .../migrations/0017_added_monitor_tables.py | 384 ++++++++++++++++++ .../jwql/migrations/0018_add_claw_columns.py | 23 ++ jwql/website/apps/jwql/monitor_models/claw.py | 4 +- jwql/website/apps/jwql/router.py | 2 +- 4 files changed, 410 insertions(+), 3 deletions(-) create mode 100644 jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py create mode 100644 jwql/website/apps/jwql/migrations/0018_add_claw_columns.py diff --git a/jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py b/jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py new file mode 100644 index 000000000..04959ec6a --- /dev/null +++ b/jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py @@ -0,0 +1,384 @@ +# Generated by Django 4.2.5 on 2024-02-22 21:16 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jwql', '0016_anomalies_bright_object_not_a_short_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='NIRSpecReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'nirspec_readnoise_stats', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRSpecReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'nirspec_readnoise_query_history', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRISSReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'niriss_readnoise_stats', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRISSReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'niriss_readnoise_query_history', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'nircam_readnoise_stats', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_readnoise_query_history', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamClawStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('filename', models.CharField(blank=True, null=True)), + ('proposal', models.CharField(blank=True, null=True)), + ('obs', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('filter', models.CharField(blank=True, null=True)), + ('pupil', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('expstart_mjd', models.FloatField(blank=True, null=True)), + ('effexptm', models.FloatField(blank=True, null=True)), + ('ra', models.FloatField(blank=True, null=True)), + ('dec', models.FloatField(blank=True, null=True)), + ('pa_v3', models.FloatField(blank=True, null=True)), + ('mean', models.FloatField(blank=True, null=True)), + ('median', models.FloatField(blank=True, null=True)), + ('stddev', models.FloatField(blank=True, null=True)), + ('frac_masked', models.FloatField(blank=True, null=True)), + ('skyflat_filename', models.CharField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_claw_stats', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='NIRCamClawQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('instrument', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ], + options={ + 'db_table': 'nircam_claw_query_history', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='MIRIReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'miri_readnoise_stats', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='MIRIReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'miri_readnoise_query_history', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='FGSReadnoiseStats', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uncal_filename', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('detector', models.CharField(blank=True, null=True)), + ('subarray', models.CharField(blank=True, null=True)), + ('read_pattern', models.CharField(blank=True, null=True)), + ('nints', models.CharField(blank=True, null=True)), + ('ngroups', models.CharField(blank=True, null=True)), + ('expstart', models.CharField(blank=True, null=True)), + ('readnoise_filename', models.CharField(blank=True, null=True)), + ('full_image_mean', models.FloatField(blank=True, null=True)), + ('full_image_stddev', models.FloatField(blank=True, null=True)), + ('full_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('full_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('readnoise_diff_image', models.CharField(blank=True, null=True)), + ('diff_image_mean', models.FloatField(blank=True, null=True)), + ('diff_image_stddev', models.FloatField(blank=True, null=True)), + ('diff_image_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('diff_image_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ('amp1_mean', models.FloatField(blank=True, null=True)), + ('amp1_stddev', models.FloatField(blank=True, null=True)), + ('amp1_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp1_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_mean', models.FloatField(blank=True, null=True)), + ('amp2_stddev', models.FloatField(blank=True, null=True)), + ('amp2_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp2_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_mean', models.FloatField(blank=True, null=True)), + ('amp3_stddev', models.FloatField(blank=True, null=True)), + ('amp3_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp3_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_mean', models.FloatField(blank=True, null=True)), + ('amp4_stddev', models.FloatField(blank=True, null=True)), + ('amp4_n', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ('amp4_bin_centers', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)), + ], + options={ + 'db_table': 'fgs_readnoise_stats', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + migrations.CreateModel( + name='FGSReadnoiseQueryHistory', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('instrument', models.CharField(blank=True, null=True)), + ('aperture', models.CharField(blank=True, null=True)), + ('start_time_mjd', models.FloatField(blank=True, null=True)), + ('end_time_mjd', models.FloatField(blank=True, null=True)), + ('entries_found', models.IntegerField(blank=True, null=True)), + ('files_found', models.IntegerField(blank=True, null=True)), + ('run_monitor', models.BooleanField(blank=True, null=True)), + ('entry_date', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'db_table': 'fgs_readnoise_query_history', + 'managed': True, + 'unique_together': {('id', 'entry_date')}, + }, + ), + ] diff --git a/jwql/website/apps/jwql/migrations/0018_add_claw_columns.py b/jwql/website/apps/jwql/migrations/0018_add_claw_columns.py new file mode 100644 index 000000000..c846d420f --- /dev/null +++ b/jwql/website/apps/jwql/migrations/0018_add_claw_columns.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.5 on 2024-02-22 21:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jwql', '0017_added_monitor_tables'), + ] + + operations = [ + migrations.AddField( + model_name='nircamclawstats', + name='doy', + field=models.FloatField(blank=True, null=True), + ), + migrations.AddField( + model_name='nircamclawstats', + name='total_bkg', + field=models.FloatField(blank=True, null=True), + ), + ] diff --git a/jwql/website/apps/jwql/monitor_models/claw.py b/jwql/website/apps/jwql/monitor_models/claw.py index cc327ddfa..a1c6c93e3 100644 --- a/jwql/website/apps/jwql/monitor_models/claw.py +++ b/jwql/website/apps/jwql/monitor_models/claw.py @@ -61,8 +61,8 @@ class NIRCamClawStats(models.Model): stddev = models.FloatField(blank=True, null=True) frac_masked = models.FloatField(blank=True, null=True) skyflat_filename = models.CharField(blank=True, null=True) -# doy = models.FloatField(blank=True, null=True) -# total_bkg = models.FloatField(blank=True, null=True) + doy = models.FloatField(blank=True, null=True) + total_bkg = models.FloatField(blank=True, null=True) class Meta: managed = True diff --git a/jwql/website/apps/jwql/router.py b/jwql/website/apps/jwql/router.py index 1baff7b8c..0053f4132 100644 --- a/jwql/website/apps/jwql/router.py +++ b/jwql/website/apps/jwql/router.py @@ -51,7 +51,7 @@ def allow_relation(self, obj1, obj2, **hints): """ if ( obj1.__class__.__name__ in MONITOR_TABLE_NAMES - or obj2.__class__.__name__ in MONITOR_TABLE_NAMES + and obj2.__class__.__name__ in MONITOR_TABLE_NAMES ): return True return None From 312c1b3f602bd9dd97ac9d4cdaca36d8a27efb18 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Thu, 22 Feb 2024 17:11:16 -0500 Subject: [PATCH 15/16] Added a check for model name --- jwql/website/apps/jwql/router.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jwql/website/apps/jwql/router.py b/jwql/website/apps/jwql/router.py index 0053f4132..b3963b82f 100644 --- a/jwql/website/apps/jwql/router.py +++ b/jwql/website/apps/jwql/router.py @@ -27,8 +27,6 @@ class MonitorRouter: JWQLDB (monitors) database. """ - route_app_labels = {"monitors"} - def db_for_read(self, model, **hints): """ Attempts to read monitor models go to monitors db. @@ -60,6 +58,6 @@ def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the monitors apps only appear in the 'monitors' database. """ - if app_label in self.route_app_labels or app_label == 'jwql': + if app_label == 'jwql' and model_name in MONITOR_TABLE_NAMES: return db == "monitors" return None From fb00490097f9f64ceb1da86ae0bba55d0071e005 Mon Sep 17 00:00:00 2001 From: "york@stsci.edu" Date: Fri, 23 Feb 2024 12:25:58 -0500 Subject: [PATCH 16/16] Come up with a set of working migrations --- .../nircam_monitors/claw_monitor.py | 1 - jwql/utils/constants.py | 84 +++++++++---------- ..._nirspecreadnoisequeryhistory_and_more.py} | 2 +- ...lawstats_doy_nircamclawstats_total_bkg.py} | 4 +- jwql/website/apps/jwql/router.py | 11 +-- 5 files changed, 51 insertions(+), 51 deletions(-) rename jwql/website/apps/jwql/migrations/{0017_added_monitor_tables.py => 0017_nirspecreadnoisestats_nirspecreadnoisequeryhistory_and_more.py} (99%) rename jwql/website/apps/jwql/migrations/{0018_add_claw_columns.py => 0018_nircamclawstats_doy_nircamclawstats_total_bkg.py} (77%) diff --git a/jwql/instrument_monitors/nircam_monitors/claw_monitor.py b/jwql/instrument_monitors/nircam_monitors/claw_monitor.py index f6d257652..b73d916c0 100644 --- a/jwql/instrument_monitors/nircam_monitors/claw_monitor.py +++ b/jwql/instrument_monitors/nircam_monitors/claw_monitor.py @@ -192,7 +192,6 @@ def make_background_plots(self, plot_type='bkg'): df = df[df['stddev'] != 0] # older data has no accurate stddev measures plot_data = df['stddev'].values if plot_type == 'model': - total_bkg = [1. for x in df['median'].values] plot_data = df['median'].values / df['total_bkg'].values plot_expstarts = df['expstart_mjd'].values diff --git a/jwql/utils/constants.py b/jwql/utils/constants.py index b19110263..7c5422594 100644 --- a/jwql/utils/constants.py +++ b/jwql/utils/constants.py @@ -655,48 +655,48 @@ # Names of all of the monitor database tables MONITOR_TABLE_NAMES = [ - "FGSBadPixelQueryHistory", "FGSBadPixelStats", - "MIRIBadPixelQueryHistory", "MIRIBadPixelStats", - "NIRCamBadPixelQueryHistory", "NIRCamBadPixelStats", - "NIRISSBadPixelQueryHistory", "NIRISSBadPixelStats", - "NIRSpecBadPixelQueryHistory", "NIRSpecBadPixelStats", - "NIRCamBiasQueryHistory", "NIRCamBiasStats", - "NIRISSBiasQueryHistory", "NIRISSBiasStats", - "NIRSpecBiasQueryHistory", "NIRSpecBiasStats", - "NIRCamClawQueryHistory", "NIRCamClawStats", - "Monitor", - "CentralStorage", - "FilesystemCharacteristics", - "FilesystemGeneral", - "FilesystemInstrument", - "FgsAnomaly", - "MiriAnomaly", - "NircamAnomaly", - "NirissAnomaly", - "NirspecAnomaly", - "FGSCosmicRayQueryHistory", "FGSCosmicRayStats", - "MIRICosmicRayQueryHistory", "MIRICosmicRayStats", - "NIRCamCosmicRayQueryHistory", "NIRCamCosmicRayStats", - "NIRISSCosmicRayQueryHistory", "NIRISSCosmicRayStats", - "NIRSpecCosmicRayQueryHistory", "NIRSpecCosmicRayStats", - "FGSDarkDarkCurrent", "FGSDarkPixelStats", "FGSDarkQueryHistory", - "MIRIDarkDarkCurrent", "MIRIDarkPixelStats", "MIRIDarkQueryHistory", - "NIRCamDarkDarkCurrent", "NIRCamDarkPixelStats", "NIRCamDarkQueryHistory", - "NIRISSDarkDarkCurrent", "NIRISSDarkPixelStats", "NIRISSDarkQueryHistory", - "NIRSpecDarkDarkCurrent", "NIRSpecDarkPixelStats", "NIRSpecDarkQueryHistory", - "FGSEdbBlocksStats", "FGSEdbDailyStats", "FGSEdbEveryChangeStats", "FGSEdbTimeIntervalStats", "FGSEdbTimeStats", - "MIRIEdbBlocksStats", "MIRIEdbDailyStats", "MIRIEdbEveryChangeStats", "MIRIEdbTimeIntervalStats", "MIRIEdbTimeStats", - "NIRCamEdbBlocksStats", "NIRCamEdbDailyStats", "NIRCamEdbEveryChangeStats", "NIRCamEdbTimeIntervalStats", "NIRCamEdbTimeStats", - "NIRISSEdbBlocksStats", "NIRISSEdbDailyStats", "NIRISSEdbEveryChangeStats", "NIRISSEdbTimeIntervalStats", "NIRISSEdbTimeStats", - "NIRSpecEdbBlocksStats", "NIRSpecEdbDailyStats", "NIRSpecEdbEveryChangeStats", "NIRSpecEdbTimeIntervalStats", "NIRSpecEdbTimeStats", - "NIRSpecGratingStats", - "FGSReadnoiseQueryHistory", "FGSReadnoiseStats", - "MIRIReadnoiseQueryHistory", "MIRIReadnoiseStats", - "NIRCamReadnoiseQueryHistory", "NIRCamReadnoiseStats", - "NIRISSReadnoiseQueryHistory", "NIRISSReadnoiseStats", - "NIRSpecReadnoiseQueryHistory", "NIRSpecReadnoiseStats", - "MIRITaQueryHistory", "MIRITaStats", - "NIRSpecTaQueryHistory", "NIRSpecTaStats" + "fgs_bad_pixel_query_history", "fgs_bad_pixel_stats", + "miri_bad_pixel_query_history", "miri_bad_pixel_stats", + "nircam_bad_pixel_query_history", "nircam_bad_pixel_stats", + "niriss_bad_pixel_query_history", "niriss_bad_pixel_stats", + "nirspec_bad_pixel_query_history", "nirspec_bad_pixel_stats", + "nircam_bias_query_history", "nircam_bias_stats", + "niriss_bias_query_history", "niriss_bias_stats", + "nirspec_bias_query_history", "nirspec_bias_stats", + "nircam_claw_query_history", "nircam_claw_stats", + "monitor", + "central_storage", + "filesystem_characteristics", + "filesystem_general", + "filesystem_instrument", + "fgs_anomaly", + "miri_anomaly", + "nircam_anomaly", + "niriss_anomaly", + "nirspec_anomaly", + "fgs_cosmic_ray_query_history", "fgs_cosmic_ray_stats", + "miri_cosmic_ray_query_history", "miri_cosmic_ray_stats", + "nircam_cosmic_ray_query_history", "nircam_cosmic_ray_stats", + "niriss_cosmic_ray_query_history", "niriss_cosmic_ray_stats", + "nirspec_cosmic_ray_query_history", "nirspec_cosmic_ray_stats", + "fgs_dark_dark_current", "fgs_dark_pixel_stats", "fgs_dark_query_history", + "miri_dark_dark_current", "miri_dark_pixel_stats", "miri_dark_query_history", + "nircam_dark_dark_current", "nircam_dark_pixel_stats", "nircam_dark_query_history", + "niriss_dark_dark_current", "niriss_dark_pixel_stats", "niriss_dark_query_history", + "nirspec_dark_dark_current", "nirspec_dark_pixel_stats", "nirspec_dark_query_history", + "fgs_edb_blocks_stats", "fgs_edb_daily_stats", "fgs_edb_every_change_stats", "fgs_edb_time_interval_stats", "fgs_edb_time_stats", + "miri_edb_blocks_stats", "miri_edb_daily_stats", "miri_edb_every_change_stats", "miri_edb_time_interval_stats", "miri_edb_time_stats", + "nircam_edb_blocks_stats", "nircam_edb_daily_stats", "nircam_edb_every_change_stats", "nircam_edb_time_interval_stats", "nircam_edb_time_stats", + "niriss_edb_blocks_stats", "niriss_edb_daily_stats", "niriss_edb_every_change_stats", "niriss_edb_time_interval_stats", "niriss_edb_time_stats", + "nirspec_edb_blocks_stats", "nirspec_edb_daily_stats", "nirspec_edb_every_change_stats", "nirspec_edb_time_interval_stats", "nirspec_edb_time_stats", + "nirspec_grating_stats", + "fgs_readnoise_query_history", "fgs_readnoise_stats", + "miri_readnoise_query_history", "miri_readnoise_stats", + "nircam_readnoise_query_history", "nircam_readnoise_stats", + "niriss_readnoise_query_history", "niriss_readnoise_stats", + "nirspec_readnoise_query_history", "nirspec_readnoise_stats", + "miri_ta_query_history", "miri_ta_stats", + "nirspec_ta_query_history", "nirspec_ta_stats" ] # Suffix for msa files diff --git a/jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py b/jwql/website/apps/jwql/migrations/0017_nirspecreadnoisestats_nirspecreadnoisequeryhistory_and_more.py similarity index 99% rename from jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py rename to jwql/website/apps/jwql/migrations/0017_nirspecreadnoisestats_nirspecreadnoisequeryhistory_and_more.py index 04959ec6a..b963ad7ad 100644 --- a/jwql/website/apps/jwql/migrations/0017_added_monitor_tables.py +++ b/jwql/website/apps/jwql/migrations/0017_nirspecreadnoisestats_nirspecreadnoisequeryhistory_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.5 on 2024-02-22 21:16 +# Generated by Django 4.2.5 on 2024-02-23 16:50 import django.contrib.postgres.fields from django.db import migrations, models diff --git a/jwql/website/apps/jwql/migrations/0018_add_claw_columns.py b/jwql/website/apps/jwql/migrations/0018_nircamclawstats_doy_nircamclawstats_total_bkg.py similarity index 77% rename from jwql/website/apps/jwql/migrations/0018_add_claw_columns.py rename to jwql/website/apps/jwql/migrations/0018_nircamclawstats_doy_nircamclawstats_total_bkg.py index c846d420f..c5efd9125 100644 --- a/jwql/website/apps/jwql/migrations/0018_add_claw_columns.py +++ b/jwql/website/apps/jwql/migrations/0018_nircamclawstats_doy_nircamclawstats_total_bkg.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.5 on 2024-02-22 21:17 +# Generated by Django 4.2.5 on 2024-02-23 16:51 from django.db import migrations, models @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('jwql', '0017_added_monitor_tables'), + ('jwql', '0017_nirspecreadnoisestats_nirspecreadnoisequeryhistory_and_more'), ] operations = [ diff --git a/jwql/website/apps/jwql/router.py b/jwql/website/apps/jwql/router.py index b3963b82f..5b08fa440 100644 --- a/jwql/website/apps/jwql/router.py +++ b/jwql/website/apps/jwql/router.py @@ -31,7 +31,7 @@ def db_for_read(self, model, **hints): """ Attempts to read monitor models go to monitors db. """ - if model.__name__ in MONITOR_TABLE_NAMES: + if model._meta.db_table in MONITOR_TABLE_NAMES: return "monitors" return None @@ -39,7 +39,7 @@ def db_for_write(self, model, **hints): """ Attempts to write monitor models go to monitors db. """ - if model.__name__ in MONITOR_TABLE_NAMES: + if model._meta.db_table in MONITOR_TABLE_NAMES: return "monitors" return None @@ -48,8 +48,8 @@ def allow_relation(self, obj1, obj2, **hints): Allow relations between tables in the monitors DB. """ if ( - obj1.__class__.__name__ in MONITOR_TABLE_NAMES - and obj2.__class__.__name__ in MONITOR_TABLE_NAMES + obj1._meta.db_table in MONITOR_TABLE_NAMES + and obj2._meta.db_table in MONITOR_TABLE_NAMES ): return True return None @@ -58,6 +58,7 @@ def allow_migrate(self, db, app_label, model_name=None, **hints): """ Make sure the monitors apps only appear in the 'monitors' database. """ - if app_label == 'jwql' and model_name in MONITOR_TABLE_NAMES: + model_names = [name.replace("_", "") for name in MONITOR_TABLE_NAMES] + if app_label == 'jwql' and model_name in model_names: return db == "monitors" return None