Skip to content

Commit

Permalink
meaningful var names
Browse files Browse the repository at this point in the history
  • Loading branch information
juanep97 committed Oct 9, 2024
1 parent 95f9ad4 commit b98b013
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
12 changes: 6 additions & 6 deletions iop4admin/modeladmins/astrosource.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def get_urls(self):

@admin.display(description='T. Andor90')
def get_texp_andor90(self, obj):
R, _ = obj.last_night_mag_R
last_night_mag_R, _ = obj.last_night_mag_R
texp = obj.texp_andor90

if R is None:
if last_night_mag_R is None:
return None

if texp is None:
Expand All @@ -90,10 +90,10 @@ def get_texp_andor90(self, obj):

@admin.display(description='T. Andor150')
def get_texp_andor150(self, obj):
R, _ = obj.last_night_mag_R
last_night_mag_R, _ = obj.last_night_mag_R
texp = obj.texp_andor150

if R is None:
if last_night_mag_R is None:
return None

if texp is None:
Expand All @@ -103,11 +103,11 @@ def get_texp_andor150(self, obj):

@admin.display(description='T. x N DIPOL')
def get_texp_dipol(self, obj):
R, _ = obj.last_night_mag_R
last_night_mag_R, _ = obj.last_night_mag_R
texp = obj.texp_dipol
nreps = obj.nreps_dipol

if R is None:
if last_night_mag_R is None:
return None

if texp is None:
Expand Down
54 changes: 27 additions & 27 deletions iop4lib/db/astrosource.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,22 +235,22 @@ def texp_andor90(self):
"""Recommneded exposure time for Andor90, based on the last R magnitude and for a SNR of 150."""

snr = 150
R, _ = self.last_night_mag_R
last_night_mag_R, _ = self.last_night_mag_R

if R is None:
if last_night_mag_R is None:
return None

T = math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*R)
texp = math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*last_night_mag_R)

if T < 30:
if texp < 30:
return 60
elif T <= 100:
elif texp <= 100:
return 150
elif T <= 250:
elif texp <= 250:
return 300
elif T <= 400:
elif texp <= 400:
return 450
elif T <= 800:
elif texp <= 800:
return 600
else:
return None
Expand All @@ -260,20 +260,20 @@ def texp_andor150(self):
"""Recommneded exposure time for Andor150, based on the last night R magnitude and for a SNR of 150."""

snr = 150
R, _ = self.last_night_mag_R
last_night_mag_R, _ = self.last_night_mag_R

if R is None:
if last_night_mag_R is None:
return None

T = 0.36 * math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*R)
texp = 0.36 * math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*last_night_mag_R)

if T < 30:
if texp < 30:
return 60
elif T <= 100:
elif texp <= 100:
return 150
elif T <= 250:
elif texp <= 250:
return 300
elif T <= 400:
elif texp <= 400:
return 450
else:
return 600
Expand All @@ -283,16 +283,16 @@ def texp_dipol(self):
"""Recommneded exposure time for DIPOL, based on the last night R magnitude and for a SNR of 150."""

snr = 150
R, _ = self.last_night_mag_R
last_night_mag_R, _ = self.last_night_mag_R

if R is None:
if last_night_mag_R is None:
return None

T = math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*R)
texp = math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*last_night_mag_R)

if T <= 300:
return math.ceil(T / 10) * 10 + 10
elif T <= 2000:
if texp <= 300:
return math.ceil(texp / 10) * 10 + 10
elif texp <= 2000:
return 300
else:
return None
Expand All @@ -302,18 +302,18 @@ def nreps_dipol(self):
"""Recommneded number of repetitions for DIPOL, based on the last night R magnitude and for a SNR of 150."""

snr = 150
R, _ = self.last_night_mag_R
last_night_mag_R, _ = self.last_night_mag_R

if R is None:
if last_night_mag_R is None:
return None

TD = math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*R)
texp = math.pow(snr,2) * 9.77 * 1e-16 * math.pow(10, 0.8*last_night_mag_R)

if TD <= 20:
if texp <= 20:
return 8
elif TD <= 40:
elif texp <= 40:
return 4
elif TD <= 80:
elif texp <= 80:
return 2
else:
return 1

0 comments on commit b98b013

Please sign in to comment.