Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 28, 2024
1 parent f2d5bf4 commit 869edfc
Show file tree
Hide file tree
Showing 45 changed files with 9 additions and 98 deletions.
6 changes: 0 additions & 6 deletions app/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

### Filter Sets ###
class TransientFilter(django_filters.FilterSet):

redshift_lte = django_filters.NumberFilter(field_name="redshift", lookup_expr="lte")
redshift_gte = django_filters.NumberFilter(field_name="redshift", lookup_expr="gte")

Expand All @@ -30,7 +29,6 @@ class Meta:

### Filter Sets ###
class HostFilter(django_filters.FilterSet):

redshift_lte = django_filters.NumberFilter(field_name="redshift", lookup_expr="lte")
redshift_gte = django_filters.NumberFilter(field_name="redshift", lookup_expr="gte")
photometric_redshift_lte = django_filters.NumberFilter(
Expand All @@ -54,7 +52,6 @@ class Meta:


class TaskRegisterFilter(django_filters.FilterSet):

transient = django_filters.Filter(field_name="transient__name")
status = django_filters.Filter(field_name="status__message")
task = django_filters.Filter(field_name="task__name")
Expand All @@ -71,7 +68,6 @@ class Meta:


class CutoutFilter(django_filters.FilterSet):

filter = django_filters.Filter(field_name="filter__name")
transient = django_filters.Filter(field_name="transient__name")

Expand All @@ -81,7 +77,6 @@ class Meta:


class AperturePhotometryFilter(django_filters.FilterSet):

filter = django_filters.Filter(field_name="filter__name")
transient = django_filters.Filter(field_name="transient__name")

Expand All @@ -91,7 +86,6 @@ class Meta:


class SEDFittingResultFilter(django_filters.FilterSet):

transient = django_filters.Filter(field_name="transient__name")
aperture_type = django_filters.Filter(field_name="aperture__type")

Expand Down
1 change: 0 additions & 1 deletion app/host/SBI/run_sbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@


def main():

# training set
data = h5py.File(sbi_params["train_fname"], "r")
x_train = np.array(data["theta"]) # physical parameters
Expand Down
12 changes: 6 additions & 6 deletions app/host/SBI/run_sbi_blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ def fit_sbi_pp(observations, n_filt_cuts=True, fit_type="global"):
wavelengths = np.append(wavelengths, f.transmission_curve().wave_effective)

obs = {}
obs["mags"] = (
mags ##np.array([maggies_to_asinh(p) for p in observations['maggies']])
)
obs["mags_unc"] = (
mags_unc ##2.5/np.log(10)*observations['maggies_unc']/observations['maggies']
)
obs[
"mags"
] = mags ##np.array([maggies_to_asinh(p) for p in observations['maggies']])
obs[
"mags_unc"
] = mags_unc ##2.5/np.log(10)*observations['maggies_unc']/observations['maggies']
obs["redshift"] = observations["redshift"]
obs["wavelengths"] = wavelengths
obs["filternames"] = filternames
Expand Down
1 change: 0 additions & 1 deletion app/host/SBI/sbi_pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ def sbi_missing_and_noisy(obs, run_params, sbi_params):
cnt_timeout = 0
timeout_flag = False
while cnt < run_params["nmc"]:

samp_y_guess = np.copy(observed)

# first, fill in the missing bands
Expand Down
2 changes: 0 additions & 2 deletions app/host/SBI/sbi_pp_fordebugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def build_obs(**extras): ##transient, aperture_type):
"""
filters = []
for filter in all_filters:

filters.append(filter.transmission_curve())

obs_data = dict(
Expand Down Expand Up @@ -1079,7 +1078,6 @@ def sbi_missing_and_noisy(obs, run_params, sbi_params):
cnt_timeout = 0
timeout_flag = False
while cnt < run_params["nmc"]:

samp_y_guess = np.copy(observed)

# first, fill in the missing bands
Expand Down
1 change: 0 additions & 1 deletion app/host/SBI/snr_vs_mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


def main():

for f in Filter.objects.all():
phot = AperturePhotometry.objects.filter(filter=f, magnitude__isnull=False)
mag = np.array(phot.values_list("magnitude", flat=True))
Expand Down
4 changes: 0 additions & 4 deletions app/host/SBI/train_sbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def build_obs(**extras): ##transient, aperture_type):
"""
filters = []
for filter in all_filters:

filters.append(filter.transmission_curve())

obs_data = dict(
Expand Down Expand Up @@ -373,7 +372,6 @@ def loc(mass):


def draw_thetas(flat=False):

if flat:
zred = priors.FastUniform(a=0.0, b=0.2 + 1e-3).sample()
logmass = priors.FastUniform(a=7.0, b=12.5).sample()
Expand Down Expand Up @@ -463,7 +461,6 @@ def draw_thetas(flat=False):


class TrainSBI(CronJobBase):

RUN_EVERY_MINS = 3

schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
Expand All @@ -478,7 +475,6 @@ def build_all(self, **kwargs):
)

def do(self, do_phot=True, do_train=False):

# parameters
needed_size = 150000
run_params = {"ichunk": 0, "needed_size": needed_size}
Expand Down
4 changes: 0 additions & 4 deletions app/host/SBI/train_sbi_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def build_obs(**extras): ##transient, aperture_type):
"""
filters = []
for filter in all_filters:

filters.append(filter.transmission_curve())

obs_data = dict(
Expand Down Expand Up @@ -373,7 +372,6 @@ def loc(mass):


def draw_thetas(flat=False):

if flat:
zred = priors.FastUniform(a=0.0, b=0.2 + 1e-3).sample()
### go 1.5 dex less for local
Expand Down Expand Up @@ -464,7 +462,6 @@ def draw_thetas(flat=False):


class TrainSBI(CronJobBase):

RUN_EVERY_MINS = 3

schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
Expand All @@ -479,7 +476,6 @@ def build_all(self, **kwargs):
)

def do(self, do_phot=True, do_train=False):

# parameters
needed_size = 150000
run_params = {"ichunk": 0, "needed_size": needed_size}
Expand Down
1 change: 0 additions & 1 deletion app/host/cutouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ def TWOMASS_cutout(position, image_size=None, filter=None):
break

if fits_image is not None:

cutout = Cutout2D(fits_image[0].data, position, image_size, wcs=wcs)
fits_image[0].data = cutout.data
fits_image[0].header.update(cutout.wcs.to_header())
Expand Down
4 changes: 0 additions & 4 deletions app/host/debug_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def _overwrite_or_create_object(model, unique_object_query, object_data):


def get_failed_tasks(transient_name=None):

if transient_name is None:
failed_task_register = TaskRegister.objects.filter(status__message="failed")
else:
Expand All @@ -37,11 +36,9 @@ def get_failed_tasks(transient_name=None):


def rerun_failed_task(task_register):

task = task_register.task
for ptask in tasks.periodic_tasks:
if ptask.task_name == task.name:

print(f"Running {task.name}")
status = ptask._run_process(task_register.transient)
print(f"Status: {status}")
Expand All @@ -52,7 +49,6 @@ def rerun_failed_task(task_register):


def set_tasks_unprocessed(transient_name):

transient = Transient.objects.get(name=transient_name)
all_tasks = TaskRegister.objects.filter(transient=transient)
for t in all_tasks:
Expand Down
2 changes: 0 additions & 2 deletions app/host/host_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ def check_global_contamination(global_aperture_phot, aperture_primary):
global_aperture_phot.aperture.cutout.fits.name,
aperture_primary.cutout.fits.name,
]:

# UV photons are too sparse, segmentation map
# builder cannot easily handle these
if "/GALEX/" in cutout_name:
Expand Down Expand Up @@ -402,7 +401,6 @@ def select_cutout_aperture(cutouts, choice=0):


def select_aperture(transient):

cutouts = Cutout.objects.filter(transient=transient)
if len(cutouts):
cutout_for_aperture = select_cutout_aperture(cutouts)
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0002_auto_20220601_1914.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0003_acknowledgement.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0002_auto_20220601_1914"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0004_filter_kcorrect_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0003_acknowledgement"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0005_prospectorresult_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0004_filter_kcorrect_name"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0006_host_milkyway_dust_reddening.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0005_prospectorresult_host"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0007_transient_processing_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0006_host_milkyway_dust_reddening"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0008_auto_20220822_2335.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0007_transient_processing_status"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0009_alter_aperturephotometry_flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0008_auto_20220822_2335"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0010_auto_20221030_1810.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0009_alter_aperturephotometry_flux"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0010_auto_20221030_1810"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0012_filter_ab_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0011_filter_magnitude_zero_point_keyword"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0012_filter_ab_offset"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0014_taskregister_user_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0013_sedfittingresult_mass_surviving_ratio"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0014_taskregister_user_warning"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0016_transient_added_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("host", "0015_alter_taskregister_user_warning"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0016_transient_added_by"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0018_auto_20240205_0240.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0017_alter_aperturephotometry_is_validated"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0019_cutout_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0018_auto_20240205_0240"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0020_transient_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0019_cutout_message"),
]
Expand Down
1 change: 0 additions & 1 deletion app/host/migrations/0021_alter_transient_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("host", "0020_transient_progress"),
]
Expand Down
Loading

0 comments on commit 869edfc

Please sign in to comment.