Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update NIRSpec TA Models #1565

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import os
import logging
from datetime import datetime, timezone, timedelta
from dateutil import parser
from random import randint

import numpy as np
Expand Down Expand Up @@ -467,7 +468,7 @@ def add_time_column(self):

def add_timezone(self, date_str):
"""Method to bypass timezone warning from Django"""
dt_timezone = datetime.fromisoformat(date_str).replace(tzinfo=timezone.utc)
dt_timezone = parser.parse(date_str).replace(tzinfo=timezone.utc)
return dt_timezone

def plt_status(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import os
import logging
from datetime import datetime, timezone, timedelta
from dateutil import parser

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -988,7 +989,7 @@ def update_ta_success_txtfile(self):

def add_timezone(self, date_str):
"""Method to bypass timezone warning from Django"""
dt_timezone = datetime.fromisoformat(date_str).replace(tzinfo=timezone.utc)
dt_timezone = parser.parse(date_str).replace(tzinfo=timezone.utc)
mfixstsci marked this conversation as resolved.
Show resolved Hide resolved
return dt_timezone

def add_wata_data(self):
Expand Down
1 change: 1 addition & 0 deletions jwql/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,3 +1059,4 @@ class QueryConfigKeys:
MAX_LEN_TIME = 50
MAX_LEN_TYPE = 40
MAX_LEN_USER = 50
MAX_LEN_VISIT = 30
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.6 on 2024-05-02 16:16
# Generated by Django 4.2.6 on 2024-05-07 15:15

import django.contrib.postgres.fields
from django.db import migrations, models
Expand All @@ -17,8 +17,8 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('filename', models.CharField(blank=True, max_length=1000, null=True)),
('date_obs', models.DateTimeField(blank=True, null=True)),
('visit_id', models.CharField(blank=True, null=True)),
('tafilter', models.CharField(blank=True, null=True)),
('visit_id', models.CharField(blank=True, max_length=30, null=True)),
('tafilter', models.CharField(blank=True, max_length=7, null=True)),
('detector', models.CharField(blank=True, max_length=40, null=True)),
('readout', models.CharField(blank=True, max_length=40, null=True)),
('subarray', models.CharField(blank=True, max_length=40, null=True)),
Expand All @@ -44,10 +44,10 @@ class Migration(migrations.Migration):
('samroll', models.FloatField(blank=True, null=True)),
('box_peak_value', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)),
('reference_star_mag', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)),
('convergence_status', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(), size=None)),
('convergence_status', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=100, null=True), size=None)),
('reference_star_number', django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(), size=None)),
('lsf_removed_status', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(), size=None)),
('lsf_removed_reason', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(), size=None)),
('lsf_removed_status', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=100, null=True), size=None)),
('lsf_removed_reason', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=100, null=True), size=None)),
('lsf_removed_x', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)),
('lsf_removed_y', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)),
('planned_v2', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(), size=None)),
Expand All @@ -67,10 +67,10 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('filename', models.CharField(blank=True, max_length=1000, null=True)),
('date_obs', models.DateTimeField(blank=True, null=True)),
('visit_id', models.CharField(blank=True, null=True)),
('tafilter', models.CharField(blank=True, null=True)),
('visit_id', models.CharField(blank=True, max_length=30, null=True)),
('tafilter', models.CharField(blank=True, max_length=7, null=True)),
('readout', models.CharField(blank=True, max_length=40, null=True)),
('ta_status', models.CharField(blank=True, null=True)),
('ta_status', models.CharField(blank=True, max_length=100, null=True)),
('star_name', models.IntegerField(blank=True, null=True)),
('star_ra', models.FloatField(blank=True, null=True)),
('star_dec', models.FloatField(blank=True, null=True)),
Expand Down
21 changes: 10 additions & 11 deletions jwql/website/apps/jwql/monitor_models/ta.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@
from jwql.utils.constants import (
MAX_LEN_APERTURE,
MAX_LEN_DETECTOR,
MAX_LEN_TIME,
MAX_LEN_FILENAME,
MAX_LEN_FILTER,
MAX_LEN_INSTRUMENT,
MAX_LEN_NGROUPS,
MAX_LEN_NINTS,
MAX_LEN_PATH,
MAX_LEN_READPATTERN,
MAX_LEN_SUBARRAY,
MAX_LEN_VISIT,
)


Expand Down Expand Up @@ -97,10 +96,10 @@ class Meta:
class NIRSpecWataStats(models.Model):
filename = models.CharField(max_length=MAX_LEN_FILENAME, blank=True, null=True)
date_obs = models.DateTimeField(blank=True, null=True)
visit_id = models.CharField(blank=True, null=True)
tafilter = models.CharField(blank=True, null=True)
visit_id = models.CharField(max_length=MAX_LEN_VISIT, blank=True, null=True)
tafilter = models.CharField(max_length=MAX_LEN_FILTER, blank=True, null=True)
readout = models.CharField(max_length=MAX_LEN_READPATTERN, blank=True, null=True)
ta_status = models.CharField(blank=True, null=True)
ta_status = models.CharField(max_length=100, blank=True, null=True)
star_name = models.IntegerField(blank=True, null=True)
star_ra = models.FloatField(blank=True, null=True)
star_dec = models.FloatField(blank=True, null=True)
Expand Down Expand Up @@ -142,8 +141,8 @@ class Meta:
class NIRSpecMsataStats(models.Model):
filename = models.CharField(max_length=MAX_LEN_FILENAME, blank=True, null=True)
date_obs = models.DateTimeField(blank=True, null=True)
visit_id = models.CharField(blank=True, null=True)
tafilter = models.CharField(blank=True, null=True)
visit_id = models.CharField(max_length=MAX_LEN_VISIT, blank=True, null=True)
tafilter = models.CharField(max_length=MAX_LEN_FILTER, blank=True, null=True)
detector = models.CharField(max_length=MAX_LEN_DETECTOR, blank=True, null=True)
readout = models.CharField(max_length=MAX_LEN_READPATTERN, blank=True, null=True)
subarray = models.CharField(max_length=MAX_LEN_SUBARRAY, blank=True, null=True)
Expand All @@ -169,10 +168,10 @@ class NIRSpecMsataStats(models.Model):
samroll = models.FloatField(blank=True, null=True)
box_peak_value = ArrayField(models.FloatField())
reference_star_mag = ArrayField(models.FloatField())
convergence_status = ArrayField(models.CharField())
convergence_status = ArrayField(models.CharField(max_length=100, blank=True, null=True))
mfixstsci marked this conversation as resolved.
Show resolved Hide resolved
reference_star_number = ArrayField(models.IntegerField())
lsf_removed_status = ArrayField(models.CharField())
lsf_removed_reason = ArrayField(models.CharField())
lsf_removed_status = ArrayField(models.CharField(max_length=100, blank=True, null=True))
lsf_removed_reason = ArrayField(models.CharField(max_length=100, blank=True, null=True))
lsf_removed_x = ArrayField(models.FloatField())
lsf_removed_y = ArrayField(models.FloatField())
planned_v2 = ArrayField(models.FloatField())
Expand Down
Loading