Skip to content
Snippets Groups Projects
Commit 870b192f authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Use physical constants from scipy instead of hard-coding

parent 992c38a3
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ buildVOEvent: Creates a complex VOEvent with tables ...@@ -7,7 +7,7 @@ buildVOEvent: Creates a complex VOEvent with tables
See the VOEvent specification for details See the VOEvent specification for details
http://www.ivoa.net/Documents/latest/VOEvent.html http://www.ivoa.net/Documents/latest/VOEvent.html
""" """
import math from scipy.constants import c, G, pi
from VOEventLib.VOEvent import VOEvent, Who, Author, Param, How, What, Group from VOEventLib.VOEvent import VOEvent, Who, Author, Param, How, What, Group
from VOEventLib.VOEvent import Citations, EventIVORN from VOEventLib.VOEvent import Citations, EventIVORN
...@@ -376,9 +376,6 @@ def buildVOEvent(event, serial_number, voevent_type, request=None, skymap_filena ...@@ -376,9 +376,6 @@ def buildVOEvent(event, serial_number, voevent_type, request=None, skymap_filena
max_hrss = max(hrss_values) max_hrss = max(hrss_values)
# From Min-A Cho: fluence = pi*(c**3)*(freq**2)*(hrss_max**2)*(10**3)/(4*G) # From Min-A Cho: fluence = pi*(c**3)*(freq**2)*(hrss_max**2)*(10**3)/(4*G)
# Note that hrss here actually has units of s^(-1/2) # Note that hrss here actually has units of s^(-1/2)
pi = math.pi
c = 2.99792E10
G = 6.674E-8
fluence = pi * pow(c,3) * pow(event.central_freq,2) fluence = pi * pow(c,3) * pow(event.central_freq,2)
fluence = fluence * pow(max_hrss,2) fluence = fluence * pow(max_hrss,2)
fluence = fluence / (4.0*G) fluence = fluence / (4.0*G)
...@@ -404,9 +401,6 @@ def buildVOEvent(event, serial_number, voevent_type, request=None, skymap_filena ...@@ -404,9 +401,6 @@ def buildVOEvent(event, serial_number, voevent_type, request=None, skymap_filena
# Note that hrss here actually has units of s^(-1/2) # Note that hrss here actually has units of s^(-1/2)
# XXX obviously need to refactor here. # XXX obviously need to refactor here.
try: try:
pi = math.pi
c = 2.99792E10
G = 6.674E-8
fluence = pi * pow(c,3) * pow(event.frequency,2) fluence = pi * pow(c,3) * pow(event.frequency,2)
fluence = fluence * pow(event.hrss,2) fluence = fluence * pow(event.hrss,2)
fluence = fluence / (4.0*G) fluence = fluence / (4.0*G)
......
...@@ -7,7 +7,7 @@ buildVOEvent: Creates a complex VOEvent with tables ...@@ -7,7 +7,7 @@ buildVOEvent: Creates a complex VOEvent with tables
See the VOEvent specification for details See the VOEvent specification for details
http://www.ivoa.net/Documents/latest/VOEvent.html http://www.ivoa.net/Documents/latest/VOEvent.html
""" """
import math from scipy.constants import c, G, pi
from VOEventLib.VOEvent import VOEvent, Who, Author, Param, How, What, Group from VOEventLib.VOEvent import VOEvent, Who, Author, Param, How, What, Group
...@@ -359,9 +359,6 @@ def construct_voevent_file(superevent, voevent, request=None, ...@@ -359,9 +359,6 @@ def construct_voevent_file(superevent, voevent, request=None,
max_hrss = max(hrss_values) max_hrss = max(hrss_values)
# From Min-A Cho: fluence = pi*(c**3)*(freq**2)*(hrss_max**2)*(10**3)/(4*G) # From Min-A Cho: fluence = pi*(c**3)*(freq**2)*(hrss_max**2)*(10**3)/(4*G)
# Note that hrss here actually has units of s^(-1/2) # Note that hrss here actually has units of s^(-1/2)
pi = math.pi
c = 2.99792E10
G = 6.674E-8
fluence = pi * pow(c,3) * pow(event.central_freq,2) fluence = pi * pow(c,3) * pow(event.central_freq,2)
fluence = fluence * pow(max_hrss,2) fluence = fluence * pow(max_hrss,2)
fluence = fluence / (4.0*G) fluence = fluence / (4.0*G)
...@@ -388,9 +385,6 @@ def construct_voevent_file(superevent, voevent, request=None, ...@@ -388,9 +385,6 @@ def construct_voevent_file(superevent, voevent, request=None,
# Note that hrss here actually has units of s^(-1/2) # Note that hrss here actually has units of s^(-1/2)
# XXX obviously need to refactor here. # XXX obviously need to refactor here.
try: try:
pi = math.pi
c = 2.99792E10
G = 6.674E-8
fluence = pi * pow(c,3) * pow(event.frequency,2) fluence = pi * pow(c,3) * pow(event.frequency,2)
fluence = fluence * pow(event.hrss,2) fluence = fluence * pow(event.hrss,2)
fluence = fluence / (4.0*G) fluence = fluence / (4.0*G)
......
...@@ -27,6 +27,7 @@ packaging==17.1 ...@@ -27,6 +27,7 @@ packaging==17.1
phonenumbers==8.8.11 phonenumbers==8.8.11
python-ldap==3.1.0 python-ldap==3.1.0
python-memcached==1.59 python-memcached==1.59
scipy==1.2.1
service_identity==17.0.0 service_identity==17.0.0
simplejson==3.15.0 simplejson==3.15.0
Sphinx==1.7.0 Sphinx==1.7.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment