Skip to content

Commit

Permalink
add calibration parameters, recalc energies in graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-dvorak committed Apr 7, 2024
1 parent 62cb41a commit 574ba8e
Show file tree
Hide file tree
Showing 18 changed files with 414 additions and 100 deletions.
25 changes: 21 additions & 4 deletions DOSPORTAL/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from import_export.admin import ImportExportModelAdmin


from django_q import models as q_models
from django_q import admin as q_admin

class AirportsResource(resources.ModelResource):
class Meta:
model = Airports
Expand Down Expand Up @@ -43,8 +46,24 @@ def user_count(self, obj):
admin.site.register(measurement)
admin.site.register(Organization, OrganizationAdmin)
#admin.site.register(OrganizationUser)
admin.site.register(Record)
admin.site.register(Detector)


class RecordAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
if obj:
form = obj.calibration_select_form()
else:
form = super().get_form(request, obj, **kwargs)
return form

admin.site.register(Record, RecordAdmin)


class DetectorAdmin(admin.ModelAdmin):
filter_horizontal = ('calib',)
pass

admin.site.register(Detector, DetectorAdmin)
admin.site.register(DetectorLogbook)
admin.site.register(DetectorType)
admin.site.register(DetectorCalib)
Expand All @@ -59,8 +78,6 @@ def user_count(self, obj):

admin.site.register(SpectrumData)

from django_q import models as q_models
from django_q import admin as q_admin

admin.site.unregister([q_models.Failure])
@admin.register(q_models.Failure)
Expand Down
2 changes: 1 addition & 1 deletion DOSPORTAL/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ class Meta:
class DetectorEditForm(forms.ModelForm):
class Meta:
model = Detector
fields = ["name", "type", 'sn', "calib", "manufactured_date", "data", "owner", "access"]
fields = ["name", "type", 'sn', "manufactured_date", "data", "owner", "access"]

19 changes: 19 additions & 0 deletions DOSPORTAL/migrations/0018_record_calib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.11 on 2024-04-06 20:21

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0017_record_metadata_file'),
]

operations = [
migrations.AddField(
model_name='record',
name='calib',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='records', to='DOSPORTAL.detectorcalib'),
),
]
17 changes: 17 additions & 0 deletions DOSPORTAL/migrations/0019_remove_detector_calib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.11 on 2024-04-06 20:24

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0018_record_calib'),
]

operations = [
migrations.RemoveField(
model_name='detector',
name='calib',
),
]
18 changes: 18 additions & 0 deletions DOSPORTAL/migrations/0020_detector_detector_calibration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-04-06 20:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0019_remove_detector_calib'),
]

operations = [
migrations.AddField(
model_name='detector',
name='Detector calibration',
field=models.ManyToManyField(blank=True, help_text='Detector calibration', related_name='detectors', to='DOSPORTAL.detectorcalib'),
),
]
17 changes: 17 additions & 0 deletions DOSPORTAL/migrations/0021_remove_detectorcalib_cabib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.11 on 2024-04-06 20:28

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0020_detector_detector_calibration'),
]

operations = [
migrations.RemoveField(
model_name='detectorcalib',
name='cabib',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.2.11 on 2024-04-06 20:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0021_remove_detectorcalib_cabib'),
]

operations = [
migrations.RemoveField(
model_name='detector',
name='Detector calibration',
),
migrations.AddField(
model_name='detector',
name='calibration',
field=models.ManyToManyField(blank=True, help_text='Detector calibration', to='DOSPORTAL.detectorcalib'),
),
]
18 changes: 18 additions & 0 deletions DOSPORTAL/migrations/0023_rename_calibration_detector_calib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-04-06 20:49

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0022_remove_detector_detector_calibration_and_more'),
]

operations = [
migrations.RenameField(
model_name='detector',
old_name='calibration',
new_name='calib',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.2.11 on 2024-04-06 22:14

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0023_rename_calibration_detector_calib'),
]

operations = [
migrations.RemoveField(
model_name='detector',
name='calib',
),
migrations.AddField(
model_name='detectorcalib',
name='created',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.CreateModel(
name='DetectorToCalibration',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('calib', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='DOSPORTAL.detectorcalib')),
('detector', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='DOSPORTAL.detector')),
],
options={
'ordering': ['calib__created'],
},
),
]
18 changes: 18 additions & 0 deletions DOSPORTAL/migrations/0025_detector_calib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-04-06 22:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0024_remove_detector_calib_detectorcalib_created_and_more'),
]

operations = [
migrations.AddField(
model_name='detector',
name='calib',
field=models.ManyToManyField(blank=True, help_text='Detector calibration', through='DOSPORTAL.DetectorToCalibration', to='DOSPORTAL.detectorcalib'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.11 on 2024-04-06 22:26

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0025_detector_calib'),
]

operations = [
migrations.RemoveField(
model_name='detector',
name='calib',
),
migrations.DeleteModel(
name='DetectorToCalibration',
),
]
18 changes: 18 additions & 0 deletions DOSPORTAL/migrations/0027_detector_calib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-04-06 22:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0026_remove_detector_calib_delete_detectortocalibration'),
]

operations = [
migrations.AddField(
model_name='detector',
name='calib',
field=models.ManyToManyField(blank=True, help_text='Detector calibration', to='DOSPORTAL.detectorcalib'),
),
]
23 changes: 23 additions & 0 deletions DOSPORTAL/migrations/0028_record_time_of_interenst_end_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.11 on 2024-04-06 23:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0027_detector_calib'),
]

operations = [
migrations.AddField(
model_name='record',
name='time_of_interenst_end',
field=models.DurationField(blank=True, default=None, null=True, verbose_name='Time of interest end'),
),
migrations.AddField(
model_name='record',
name='time_of_interenst_start',
field=models.DurationField(blank=True, default=None, null=True, verbose_name='Time of interest start'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.11 on 2024-04-06 23:50

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('DOSPORTAL', '0028_record_time_of_interenst_end_and_more'),
]

operations = [
migrations.RenameField(
model_name='record',
old_name='time_of_interenst_end',
new_name='time_of_interest_end',
),
migrations.RenameField(
model_name='record',
old_name='time_of_interenst_start',
new_name='time_of_interest_start',
),
]
Loading

0 comments on commit 574ba8e

Please sign in to comment.