Exemple #1
0
def add_transient(obj):
    import os
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'torosweb.settings')
    import django
    django.setup()
    from winnow.models import TransientCandidate, Dataset

    try:
        ds = Dataset.objects.get(name=obj['dataset'])
    except:
        ds = Dataset()
        ds.name = obj['dataset']
        ds.isCurrent = True
        ds.save()

    t = TransientCandidate()
    t.ra         = obj['ra']
    t.dec        = obj['dec']
    t.x_pix      = obj['x']
    t.y_pix      = obj['y']
    t.height     = obj['ymax'] - obj['ymin']
    t.width      = obj['xmax'] - obj['xmin']
    t.filename   = obj['filename']
    t.dataset = ds
    t.object_id = obj['object_id']
    t.save()
    t.refImg  = 'object_images/%s_ref.png' % (t.slug)
    t.subtImg = 'object_images/%s_subt.png' % (t.slug)
    t.origImg = 'object_images/%s_orig.png' % (t.slug)
    t.save()

    return t
Exemple #2
0
def add_transient(obj):
    import os
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'torosweb.settings')
    import django
    django.setup()
    from winnow.models import TransientCandidate, Dataset

    try:
        ds = Dataset.objects.get(name=obj['dataset'])
    except:
        ds = Dataset()
        ds.name = obj['dataset']
        ds.isCurrent = True
        ds.save()

    t = TransientCandidate()
    t.ra = obj['ra']
    t.dec = obj['dec']
    t.x_pix = obj['x']
    t.y_pix = obj['y']
    t.height = obj['ymax'] - obj['ymin']
    t.width = obj['xmax'] - obj['xmin']
    t.filename = obj['filename']
    t.dataset = ds
    t.object_id = obj['object_id']
    t.save()
    t.refImg = 'object_images/%s_ref.png' % (t.slug)
    t.subtImg = 'object_images/%s_subt.png' % (t.slug)
    t.origImg = 'object_images/%s_orig.png' % (t.slug)
    t.save()

    return t