54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
# uplim/models.py
|
|
|
|
from django.db import models
|
|
from django.db.models import UniqueConstraint
|
|
|
|
|
|
|
|
|
|
class Pixel(models.Model):
|
|
|
|
#id = models.AutoField(primary_key=True) # ~200 million pixels for a 4096 survey
|
|
# no need to set explicitly
|
|
# WILL ONLY HOLD 10 SURVEYS AS AN AUTOFIELD (IntegerField, ~2 billion limit)
|
|
# BIGAUTOFIELD WILL BE REQUIRED FOR MORE!
|
|
|
|
survey = models.PositiveSmallIntegerField()
|
|
|
|
hpid = models.IntegerField(db_index=True) # up to over 200 million
|
|
|
|
counts = models.IntegerField() # f4, up to ~44k integer: 2 byte too small
|
|
|
|
exposure = models.FloatField() # f4, up to ~13300 float
|
|
|
|
contaminated = models.BooleanField(default=False)
|
|
|
|
def __str__(self):
|
|
return f"Pixel {self.id} hpid {self.hpid} (Survey {self.survey.number})"
|
|
|
|
|
|
|
|
|
|
class CatalogSource(models.Model):
|
|
|
|
srcid = models.SmallIntegerField(primary_key=True)
|
|
|
|
name = models.CharField(max_length=21)
|
|
|
|
ra_deg = models.FloatField()
|
|
|
|
dec_deg = models.FloatField()
|
|
|
|
pos_error = models.FloatField()
|
|
|
|
significance = models.FloatField()
|
|
|
|
flux = models.FloatField()
|
|
|
|
flux_error = models.FloatField()
|
|
|
|
catalog_name = models.CharField(max_length=28)
|
|
|
|
new_xray = models.BooleanField(default=False)
|
|
|
|
source_type = models.CharField(max_length=13) |