Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop djones ps12 #232

Merged
merged 23 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions YSE_App/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class FollowupStatusViewSet(viewsets.ReadOnlyModelViewSet):
class SurveyFieldFilter(django_filters.FilterSet):
field_id = django_filters.Filter(field_name="field_id")
obs_group = django_filters.Filter(field_name="obs_group__name")
instrument = django_filters.Filter(field_name="instrument__name")
class Meta:
model = SurveyField
fields = ()
Expand All @@ -49,6 +50,7 @@ class Meta:
class SurveyFieldMSBFilter(django_filters.FilterSet):
name = django_filters.Filter(field_name="name")
active = django_filters.Filter(field_name="active")
instrument = django_filters.Filter(field_name='survey_fields__instrument__name')
class Meta:
model = SurveyFieldMSB
fields = ('name','active')
Expand Down Expand Up @@ -83,7 +85,8 @@ class SurveyObsFilter(django_filters.FilterSet):
ra_lt = django_filters.Filter(field_name="survey_field__ra_cen", lookup_expr='lt')
dec_gt = django_filters.Filter(field_name="survey_field__dec_cen", lookup_expr='gt')
dec_lt = django_filters.Filter(field_name="survey_field__dec_cen", lookup_expr='lt')

instrument = django_filters.Filter(field_name="survey_field__instrument__name")

class Meta:
model = SurveyObservation
fields = ()
Expand Down Expand Up @@ -111,11 +114,21 @@ class InternalSurveyViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class = InternalSurveySerializer
permission_classes = (permissions.IsAuthenticated,)

### `ObservationGroup` Filter Set ###
class ObservationGroupFilter(django_filters.FilterSet):
name = django_filters.Filter(field_name="name")

class Meta:
model = ObservationGroup
fields = ()

class ObservationGroupViewSet(viewsets.ReadOnlyModelViewSet):
queryset = ObservationGroup.objects.all()
serializer_class = ObservationGroupSerializer
permission_classes = (permissions.IsAuthenticated,)

filter_backends = (DjangoFilterBackend,)
filter_class = ObservationGroupFilter

class SEDTypeViewSet(viewsets.ReadOnlyModelViewSet):
queryset = SEDType.objects.all()
serializer_class = SEDTypeSerializer
Expand Down Expand Up @@ -190,13 +203,23 @@ class HostSEDViewSet(custom_viewsets.ListCreateRetrieveUpdateViewSet):
serializer_class = HostSEDSerializer
permission_classes = (permissions.IsAuthenticated,)

### `Instrument` Filter Set ###
class InstrumentFilter(django_filters.FilterSet):
name = django_filters.Filter(field_name="name")
class Meta:
model = Instrument
fields = ()

### `Instrument` ViewSets ###
class InstrumentViewSet(custom_viewsets.ListCreateRetrieveUpdateViewSet):
queryset = Instrument.objects.all()
serializer_class = InstrumentSerializer
lookup_field = "id"
permission_classes = (permissions.IsAuthenticated,)
filter_backends = (DjangoFilterBackend,)
filter_class = InstrumentFilter


class InstrumentConfigViewSet(custom_viewsets.ListCreateRetrieveUpdateViewSet):
queryset = InstrumentConfig.objects.all()
serializer_class = InstrumentConfigSerializer
Expand Down
2 changes: 1 addition & 1 deletion YSE_App/data_ingest/DECam_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def add_options(self, parser=None, usage=None, config=None):
parser.add_argument('--SMTP_PORT', default=config.get('SMTP_provider','SMTP_PORT'), type=str,
help='SMTP port (default=%default)')

parser.add_argument('--max_decam_days', default=config.get('main','max_days_decam'), type=float,
parser.add_argument('--max_decam_days', default=config.get('yse','max_days_decam'), type=float,
help='grab photometry/objects from the last x days')

else:
Expand Down
2 changes: 1 addition & 1 deletion YSE_App/data_ingest/DECam_upload_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def add_options(self, parser=None, usage=None, config=None):
parser.add_argument('--SMTP_PORT', default=config.get('SMTP_provider','SMTP_PORT'), type=str,
help='SMTP port (default=%default)')

parser.add_argument('--max_decam_days', default=config.get('main','max_days_decam'), type=float,
parser.add_argument('--max_decam_days', default=config.get('yse','max_days_decam'), type=float,
help='grab photometry/objects from the last x days')

else:
Expand Down
58 changes: 26 additions & 32 deletions YSE_App/data_ingest/QUB_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,18 @@ def add_options(self, parser=None, usage=None, config=None):
help='email password, if post=True (default=%default)')
parser.add_argument('--dburl', default=config.get('main','dburl'), type=str,
help='URL to POST transients to a database (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
parser.add_argument('--ztfurl', default=config.get('ztf','ztfurl'), type=str,
help='ZTF URL (default=%default)')
parser.add_argument('--STATIC', default=config.get('site_settings','STATIC'), type=str,
help='static directory (default=%default)')
parser.add_argument('--qubuser', default=config.get('main','qubuser'), type=str,
parser.add_argument('--qubuser', default=config.get('yse','qubuser'), type=str,
help='QUB database username (default=%default)')
parser.add_argument('--qubpass', default=config.get('main','qubpass'), type=str,
parser.add_argument('--qubpass', default=config.get('yse','qubpass'), type=str,
help='QUB database password (default=%default)')
parser.add_argument('--psstlink_summary', default=config.get('main','psstlink_summary'), type=str,
parser.add_argument('--psstlink_summary', default=config.get('yse','psstlink_summary'), type=str,
help='PSST summary CSV (default=%default)')
parser.add_argument('--psstlink_lc', default=config.get('main','psstlink_lc'), type=str,
parser.add_argument('--psstlink_lc', default=config.get('yse','psstlink_lc'), type=str,
help='PSST lightcurve CSV (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
help='ZTF URL (default=%default)')


parser.add_argument('--SMTP_LOGIN', default=config.get('SMTP_provider','SMTP_LOGIN'), type=str,
Expand All @@ -222,7 +220,7 @@ def add_options(self, parser=None, usage=None, config=None):
parser.add_argument('--SMTP_PORT', default=config.get('SMTP_provider','SMTP_PORT'), type=str,
help='SMTP port (default=%default)')

parser.add_argument('--max_days', default=config.get('main','max_days_qub'), type=float,
parser.add_argument('--max_days', default=config.get('yse','max_days_qub'), type=float,
help='grab photometry/objects from the last x days')

else:
Expand Down Expand Up @@ -540,24 +538,22 @@ def add_options(self, parser=None, usage=None, config=None):
help='email password, if post=True (default=%default)')
parser.add_argument('--dburl', default=config.get('main','dburl'), type=str,
help='URL to POST transients to a database (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
parser.add_argument('--ztfurl', default=config.get('ztf','ztfurl'), type=str,
help='ZTF URL (default=%default)')
parser.add_argument('--STATIC', default=config.get('site_settings','STATIC'), type=str,
help='static directory (default=%default)')
parser.add_argument('--qubuser', default=config.get('main','qubuser'), type=str,
parser.add_argument('--qubuser', default=config.get('yse','qubuser'), type=str,
help='QUB database username (default=%default)')
parser.add_argument('--qubpass', default=config.get('main','qubpass'), type=str,
parser.add_argument('--qubpass', default=config.get('yse','qubpass'), type=str,
help='QUB database password (default=%default)')
parser.add_argument('--yselink_summary', default=config.get('main','yselink_summary'), type=str,
parser.add_argument('--yselink_summary', default=config.get('yse','yselink_summary'), type=str,
help='YSE summary CSV (default=%default)')
parser.add_argument('--yselink_lc', default=config.get('main','yselink_lc'), type=str,
parser.add_argument('--yselink_lc', default=config.get('yse','yselink_lc'), type=str,
help='YSE lightcurve CSV (default=%default)')
parser.add_argument('--yselink_genericsummary', default=config.get('main','yselink_genericsummary'), type=str,
parser.add_argument('--yselink_genericsummary', default=config.get('yse','yselink_genericsummary'), type=str,
help='YSE summary CSV for possible candidates (default=%default)')
parser.add_argument('--yselink_genericlc', default=config.get('main','yselink_genericlc'), type=str,
parser.add_argument('--yselink_genericlc', default=config.get('yse','yselink_genericlc'), type=str,
help='YSE lightcurve CSV for possible candidates (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
help='ZTF URL (default=%default)')


parser.add_argument('--SMTP_LOGIN', default=config.get('SMTP_provider','SMTP_LOGIN'), type=str,
Expand All @@ -567,7 +563,7 @@ def add_options(self, parser=None, usage=None, config=None):
parser.add_argument('--SMTP_PORT', default=config.get('SMTP_provider','SMTP_PORT'), type=str,
help='SMTP port (default=%default)')

parser.add_argument('--max_days', default=config.get('main','max_days_yse'), type=float,
parser.add_argument('--max_days', default=config.get('yse','max_days_yse'), type=float,
help='grab photometry/objects from the last x days')

else:
Expand Down Expand Up @@ -1004,31 +1000,29 @@ def add_options(self, parser=None, usage=None, config=None):
help='email password, if post=True (default=%default)')
parser.add_argument('--dburl', default=config.get('main','dburl'), type=str,
help='URL to POST transients to a database (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
parser.add_argument('--ztfurl', default=config.get('ztf','ztfurl'), type=str,
help='ZTF URL (default=%default)')
parser.add_argument('--STATIC', default=config.get('site_settings','STATIC'), type=str,
help='static directory (default=%default)')
parser.add_argument('--qubuser', default=config.get('main','qubuser'), type=str,
parser.add_argument('--qubuser', default=config.get('yse','qubuser'), type=str,
help='QUB database username (default=%default)')
parser.add_argument('--qubpass', default=config.get('main','qubpass'), type=str,
parser.add_argument('--qubpass', default=config.get('yse','qubpass'), type=str,
help='QUB database password (default=%default)')
parser.add_argument('--yselink_stacksummary', default=config.get('main','yselink_stacksummary'), type=str,
parser.add_argument('--yselink_stacksummary', default=config.get('yse','yselink_stacksummary'), type=str,
help='YSE summary CSV for possible candidates (default=%default)')
parser.add_argument('--yselink_stacklc', default=config.get('main','yselink_stacklc'), type=str,
parser.add_argument('--yselink_stacklc', default=config.get('yse','yselink_stacklc'), type=str,
help='YSE lightcurve CSV for possible candidates (default=%default)')
parser.add_argument('--yselink_agnsummary', default=config.get('main','yselink_agnsummary'), type=str,
parser.add_argument('--yselink_agnsummary', default=config.get('yse','yselink_agnsummary'), type=str,
help='YSE summary CSV for possible candidates (default=%default)')
parser.add_argument('--yselink_agnlc', default=config.get('main','yselink_agnlc'), type=str,
parser.add_argument('--yselink_agnlc', default=config.get('yse','yselink_agnlc'), type=str,
help='YSE lightcurve CSV for possible candidates (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
help='ZTF URL (default=%default)')
parser.add_argument('--max_days_ysestacklc', default=config.get('main','max_days_ysestacklc'), type=float,
parser.add_argument('--max_days_ysestacklc', default=config.get('yse','max_days_ysestacklc'), type=float,
help='maximum days to look back for lightcurves (default=%default)')
parser.add_argument('--max_days_yseignore', default=config.get('main','max_days_ysestackignore'), type=float,
parser.add_argument('--max_days_yseignore', default=config.get('yse','max_days_ysestackignore'), type=float,
help='maximum days to look back for lightcurves (default=%default)')
parser.add_argument('--max_days_yseagnlc', default=config.get('main','max_days_yseagnlc'), type=float,
parser.add_argument('--max_days_yseagnlc', default=config.get('yse','max_days_yseagnlc'), type=float,
help='maximum days to look back for lightcurves (default=%default)')
parser.add_argument('--max_days_yseagnignore', default=config.get('main','max_days_yseagnignore'), type=float,
parser.add_argument('--max_days_yseagnignore', default=config.get('yse','max_days_yseagnignore'), type=float,
help='maximum days to look back for lightcurves (default=%default)')

parser.add_argument('--SMTP_LOGIN', default=config.get('SMTP_provider','SMTP_LOGIN'), type=str,
Expand Down Expand Up @@ -1505,7 +1499,7 @@ def main(self):
from YSE_App.models import Transient
# 10HYSEkcp

transients = Transient.objects.filter(created_date__gt=datetime.datetime.now()-datetime.timedelta(1)).filter(name__startswith='10')
transients = Transient.objects.filter(created_date__gt=datetime.datetime.now()-datetime.timedelta(1)).filter(name__startswith='1')
for t in transients:
ramin,ramax,decmin,decmax = getRADecBox(t.ra,t.dec,size=0.00042)
dups = Transient.objects.filter(Q(ra__gt=ramin) & Q(ra__lt=ramax) &
Expand Down
2 changes: 1 addition & 1 deletion YSE_App/data_ingest/Query_ZTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def add_options(self, parser=None, usage=None, config=None):
parser.add_option('--SMTP_PORT', default=config.get('SMTP_provider','SMTP_PORT'), type="string",
help='SMTP port (default=%default)')

parser.add_option('--ztfurl', default=config.get('main','ztfurl'), type="string",
parser.add_option('--ztfurl', default=config.get('ztf','ztfurl'), type="string",
help='ZTF URL (default=%default)')

else:
Expand Down
2 changes: 1 addition & 1 deletion YSE_App/data_ingest/TNS_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def add_options(self, parser=None, usage=None, config=None):
help='time interval for grabbing very recent TNS events (default=%default)')
parser.add_argument('--hostmatchrad', default=config.get('main','hostmatchrad'), type=float,
help='matching radius for hosts (arcmin) (default=%default)')
parser.add_argument('--ztfurl', default=config.get('main','ztfurl'), type=str,
parser.add_argument('--ztfurl', default=config.get('ztf','ztfurl'), type=str,
help='ZTF URL (default=%default)')

parser.add_argument('--SMTP_LOGIN', default=config.get('SMTP_provider','SMTP_LOGIN'), type=str,
Expand Down
Loading