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

Claw monitor migrate #1492

Merged
merged 6 commits into from
Feb 20, 2024

Conversation

york-stsci
Copy link
Collaborator

Migrates the claw monitor to using the django models. This is an initial PR, with a second to follow which will add the new columns to the claw monitor.

@pep8speaks
Copy link

pep8speaks commented Feb 20, 2024

Hello @york-stsci, Thank you for updating !

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated at 2024-02-20 16:13:52 UTC

Copy link
Collaborator

@mfixstsci mfixstsci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @york-stsci this looks good to me.

jwql/instrument_monitors/nircam_monitors/claw_monitor.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@bsunnquist bsunnquist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me - thanks a lot for getting this switched over to django models, the documentation with examples on how to work with them is especially useful.

Perhaps more relevant for the next PR, but I do store nans for the total_bkg if the JBT tool fails for whatever reason - do you know if django can store nans ok in the float columns, or should I switch it to something else?

@york-stsci
Copy link
Collaborator Author

As I recall, the "nan" value is explicitly defined in the IEEE double-precision floating point standard (which is the floating-point value that all of our database tables use), so it's possible that we might have to convert it from np.nan to float.nan (where that latter one isn't actually a thing in python as far as I know, but there's undoubtedly a way to generate a floating-point nan value).

@york-stsci york-stsci merged commit b4754d1 into spacetelescope:develop Feb 20, 2024
6 checks passed
@york-stsci york-stsci deleted the claw_monitor_migrate branch February 20, 2024 17:20
@@ -319,13 +331,12 @@ 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),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for commenting these out?

@@ -158,8 +157,9 @@ def claw_monitor(request):
template = "claw_monitor.html"

# Get all recent claw stack images from the last 10 days
query = session.query(NIRCamClawStats.expstart_mjd, NIRCamClawStats.skyflat_filename).order_by(NIRCamClawStats.expstart_mjd.desc()).all()
df = pd.DataFrame(query, columns=['expstart_mjd', 'skyflat_filename'])
query = NIRCamClawStats.objects # .filter(expstart_mjd__gte=(Time.now().mjd - 10))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming we will want to remove the comment this after the first run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants