Skip to content

Commit

Permalink
Correct paths
Browse files Browse the repository at this point in the history
  • Loading branch information
maja-jablonska committed May 4, 2022
1 parent 30a64f6 commit 7b2f481
Show file tree
Hide file tree
Showing 33 changed files with 94 additions and 89 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "bhtom_registration"]
path = bhtom_registration
url = https://github.com/maja-jablonska/bhtom_registration
[submodule "bhtom_custom_registration"]
path = bhtom_custom_registration
url = https://github.com/maja-jablonska/bhtom_custom_registration
8 changes: 5 additions & 3 deletions Docker/web_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ COPY requirements.txt /requirements.txt
COPY manage.py /manage.py
COPY entrypoint.sh /entrypoint.sh

COPY bhtom2 /bhtom2
COPY bhtom_base /bhtom_base
COPY bhtom_custom_registration /bhtom_custom_registration
COPY Docker/.bhtom.env /bhtom2/.bhtom.env

RUN pwd

RUN --mount=type=cache,target=/root/.cache python -m pip install -r requirements.txt

COPY bhtom2 /bhtom2
COPY Docker/.bhtom.env /bhtom2/.bhtom.env

CMD ["sh", "entrypoint.sh"]
4 changes: 2 additions & 2 deletions bhtom2/brokers/aavso.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from django.conf import settings
from django.db import transaction

from bhtom_dataproducts.models import ReducedDatum, DatumValue
from bhtom_targets.models import Target
from bhtom_base.bhtom_dataproducts.models import ReducedDatum, DatumValue
from bhtom_base.bhtom_targets.models import Target

from bhtom2.brokers.bhtom_broker import BHTOMBroker, LightcurveUpdateReport, return_for_no_new_points
from bhtom2.external_service.data_source_information import DataSource, AAVSO_ACCEPTED_FLAGS, FILTERS
Expand Down
6 changes: 3 additions & 3 deletions bhtom2/brokers/antares.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import marshmallow
from django.db import transaction

from bhtom_alerts.alerts import GenericQueryForm, GenericAlert
from bhtom_dataproducts.models import ReducedDatum, DatumValue
from bhtom_targets.models import Target, TargetName
from bhtom_base.bhtom_alerts.alerts import GenericQueryForm, GenericAlert
from bhtom_base.bhtom_dataproducts.models import ReducedDatum, DatumValue
from bhtom_base.bhtom_targets.models import Target, TargetName

from bhtom2.brokers.bhtom_broker import BHTOMBroker, return_for_no_new_points
from bhtom2.brokers.lightcurve_update import LightcurveUpdateReport
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/brokers/bhtom_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import List, Optional

import numpy as np
from bhtom_alerts.alerts import GenericBroker
from bhtom_targets.models import Target
from bhtom_base.bhtom_alerts.alerts import GenericBroker
from bhtom_base.bhtom_targets.models import Target

from bhtom2.external_service.data_source_information import DataSource, FILTERS, TARGET_NAME_KEYS
from bhtom2.external_service.filter_name import filter_name
Expand Down
8 changes: 4 additions & 4 deletions bhtom2/brokers/gaia_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
from django import forms
from django.db import transaction

from bhtom_alerts.alerts import GenericAlert
from bhtom_alerts.alerts import GenericQueryForm
from bhtom_dataproducts.models import ReducedDatum
from bhtom_base.bhtom_alerts.alerts import GenericAlert
from bhtom_base.bhtom_alerts.alerts import GenericQueryForm
from bhtom_base.bhtom_dataproducts.models import ReducedDatum

from bhtom2 import settings
from bhtom2.brokers.bhtom_broker import BHTOMBroker, LightcurveUpdateReport, return_for_no_new_points
from bhtom2.external_service.data_source_information import DataSource, FILTERS
from bhtom2.external_service.external_service_request import query_external_service
from bhtom2.external_service.filter_name import filter_name
from bhtom_dataproducts.models import DatumValue
from bhtom_base.bhtom_dataproducts.models import DatumValue


def g_gaia_error(mag: float) -> float:
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/brokers/lightcurve_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from bhtom_dataproducts.models import ReducedDatum
from bhtom_targets.models import Target
from bhtom_base.bhtom_dataproducts.models import ReducedDatum
from bhtom_base.bhtom_targets.models import Target

LightcurveUpdateReport = namedtuple('LightcurveUpdateReport', ['new_points', 'last_jd', 'last_mag'])

Expand Down
4 changes: 2 additions & 2 deletions bhtom2/brokers/ztf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from bhtom2.exceptions.external_service import NoResultException, InvalidExternalServiceResponseException
from bhtom2.external_service.data_source_information import DataSource, FILTERS, ZTF_DR8_FILTERS
from bhtom2.external_service.external_service_request import query_external_service
from bhtom_dataproducts.models import ReducedDatum, DatumValue
from bhtom_targets.models import Target, TargetExtra
from bhtom_base.bhtom_dataproducts.models import ReducedDatum, DatumValue
from bhtom_base.bhtom_targets.models import Target, TargetExtra


# For DR8
Expand Down
2 changes: 1 addition & 1 deletion bhtom2/dataproducts/dataproduct_extra_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Dict, List, Optional, Any
import json

from bhtom_dataproducts.models import DataProduct
from bhtom_base.bhtom_dataproducts.models import DataProduct

from bhtom2.utils.bhtom_logger import BHTOMLogger

Expand Down
2 changes: 1 addition & 1 deletion bhtom2/dataproducts/last_jd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target
import logging
from typing import Optional
from sentry_sdk import capture_exception
Expand Down
2 changes: 1 addition & 1 deletion bhtom2/dataproducts/sun_separation_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from astropy import units as u
from astropy.coordinates import get_sun, SkyCoord
from astropy.time import Time
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target

from bhtom2.utils.bhtom_logger import BHTOMLogger

Expand Down
2 changes: 1 addition & 1 deletion bhtom2/external_service/catalog_name_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from bhtom2.external_service.data_source_information import DataSource, TARGET_NAME_KEYS
from bhtom2.utils.bhtom_logger import BHTOMLogger
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target

logger: BHTOMLogger = BHTOMLogger(__name__, '[Catalog name lookup]')
alerce: Alerce = Alerce()
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/harvesters/antares.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional

from django.core.exceptions import ObjectDoesNotExist
from bhtom_catalogs.harvester import AbstractHarvester
from bhtom_targets.models import Target
from bhtom_base.bhtom_catalogs.harvester import AbstractHarvester
from bhtom_base.bhtom_targets.models import Target

from antares_client.search import get_by_ztf_object_id, get_by_id
from antares_client._api.models import Locus
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/harvesters/gaia_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import pandas as pd
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from bhtom_catalogs.harvester import AbstractHarvester
from bhtom_targets.models import Target
from bhtom_base.bhtom_catalogs.harvester import AbstractHarvester
from bhtom_base.bhtom_targets.models import Target

from bhtom2.exceptions.external_service import NoResultException, InvalidExternalServiceResponseException
from bhtom2.external_service.data_source_information import DataSource, TARGET_NAME_KEYS
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/harvesters/tns.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from collections import OrderedDict
from django.conf import settings

from bhtom_catalogs.harvester import AbstractHarvester
from bhtom_common.exceptions import ImproperCredentialsException
from bhtom_base.bhtom_catalogs.harvester import AbstractHarvester
from bhtom_base.bhtom_common.exceptions import ImproperCredentialsException

TNS_URL = 'https://www.wis-tns.org'

Expand Down
2 changes: 1 addition & 1 deletion bhtom2/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from bhtom2.external_service.catalog_name_lookup import query_all_services
from bhtom2.utils.bhtom_logger import BHTOMLogger
from bhtom2.utils.extinction import ogle_extinction
from bhtom_targets.models import TargetExtra
from bhtom_base.bhtom_targets.models import TargetExtra

logger: BHTOMLogger = BHTOMLogger(__name__, '[Hooks]')

Expand Down
64 changes: 32 additions & 32 deletions bhtom2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


# Build paths inside the project like this: os.path.join(BASE_DIR, ...)

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Environment variables
Expand Down Expand Up @@ -56,20 +57,19 @@
'django.contrib.sites',
'django_extensions',
'guardian',
'bhtom_base',
'bhtom_common',
'bhtom_base.bhtom_common',
'django_comments',
'bootstrap4',
'crispy_forms',
'rest_framework',
'django_filters',
'django_gravatar',
'bhtom_targets',
'bhtom_alerts',
'bhtom_catalogs',
'bhtom_observations',
'bhtom_dataproducts',
'bhtom_registration',
'bhtom_base.bhtom_targets',
'bhtom_base.bhtom_alerts',
'bhtom_base.bhtom_catalogs',
'bhtom_base.bhtom_observations',
'bhtom_base.bhtom_dataproducts',
'bhtom_custom_registration.bhtom_registration',
'rest_framework.authtoken',
'bhtom2'
]
Expand All @@ -82,10 +82,10 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'bhtom_common.middleware.Raise403Middleware',
'bhtom_common.middleware.ExternalServiceMiddleware',
'bhtom_common.middleware.AuthStrategyMiddleware',
'bhtom_registration.middleware.RedirectAuthenticatedUsersFromRegisterMiddleware',
'bhtom_base.bhtom_common.middleware.Raise403Middleware',
'bhtom_base.bhtom_common.middleware.ExternalServiceMiddleware',
'bhtom_base.bhtom_common.middleware.AuthStrategyMiddleware',
'bhtom_custom_registration.bhtom_registration.middleware.RedirectAuthenticatedUsersFromRegisterMiddleware',
]

ROOT_URLCONF = 'bhtom2.urls'
Expand Down Expand Up @@ -276,25 +276,25 @@
}

DATA_PROCESSORS = {
'photometry': 'bhtom_dataproducts.processors.photometry_processor.PhotometryProcessor',
'spectroscopy': 'bhtom_dataproducts.processors.spectroscopy_processor.SpectroscopyProcessor',
'photometry': 'bhtom_base.bhtom_dataproducts.processors.photometry_processor.PhotometryProcessor',
'spectroscopy': 'bhtom_base.bhtom_dataproducts.processors.spectroscopy_processor.SpectroscopyProcessor',
}

TOM_FACILITY_CLASSES = [
'bhtom_observations.facilities.lco.LCOFacility',
'bhtom_observations.facilities.gemini.GEMFacility',
'bhtom_observations.facilities.soar.SOARFacility',
'bhtom_observations.facilities.lt.LTFacility'
'bhtom_base.bhtom_observations.facilities.lco.LCOFacility',
'bhtom_base.bhtom_observations.facilities.gemini.GEMFacility',
'bhtom_base.bhtom_observations.facilities.soar.SOARFacility',
'bhtom_base.bhtom_observations.facilities.lt.LTFacility'
]

TOM_ALERT_CLASSES = [
'bhtom_alerts.brokers.alerce.ALeRCEBroker',
'bhtom_alerts.brokers.lasair.LasairBroker',
'bhtom_alerts.brokers.mars.MARSBroker',
'bhtom_alerts.brokers.scimma.SCIMMABroker',
'bhtom_alerts.brokers.scout.ScoutBroker',
'bhtom_alerts.brokers.tns.TNSBroker',
'bhtom_alerts.brokers.fink.FinkBroker',
'bhtom_base.bhtom_alerts.brokers.alerce.ALeRCEBroker',
'bhtom_base.bhtom_alerts.brokers.lasair.LasairBroker',
'bhtom_base.bhtom_alerts.brokers.mars.MARSBroker',
'bhtom_base.bhtom_alerts.brokers.scimma.SCIMMABroker',
'bhtom_base.bhtom_alerts.brokers.scout.ScoutBroker',
'bhtom_base.bhtom_alerts.brokers.tns.TNSBroker',
'bhtom_base.bhtom_alerts.brokers.fink.FinkBroker',
'bhtom2.brokers.gaia_alerts.GaiaAlertsBroker',
'bhtom2.brokers.aavso.AAVSOBroker',
'bhtom2.brokers.ztf.ZTFBroker',
Expand All @@ -311,9 +311,9 @@
'bhtom2.harvesters.gaia_alerts.GaiaAlertsHarvester',
'bhtom2.harvesters.tns.TNSHarvester',
'bhtom2.harvesters.antares.ANTARESHarvester',
'bhtom_catalogs.harvesters.simbad.SimbadHarvester',
'bhtom_catalogs.harvesters.ned.NEDHarvester',
'bhtom_catalogs.harvesters.jplhorizons.JPLHorizonsHarvester',
'bhtom_base.bhtom_catalogs.harvesters.simbad.SimbadHarvester',
'bhtom_base.bhtom_catalogs.harvesters.ned.NEDHarvester',
'bhtom_base.bhtom_catalogs.harvesters.jplhorizons.JPLHorizonsHarvester',
]

HARVESTERS = {
Expand Down Expand Up @@ -367,10 +367,10 @@

HOOKS = {
'target_post_save': 'bhtom2.hooks.target_post_save',
'observation_change_state': 'bhtom_common.hooks.observation_change_state',
'data_product_post_upload': 'bhtom_dataproducts.hooks.data_product_post_upload',
'data_product_post_save': 'bhtom_dataproducts.hooks.data_product_post_save',
'multiple_data_products_post_save': 'bhtom_dataproducts.hooks.multiple_data_products_post_save',
'observation_change_state': 'bhtom_base.bhtom_common.hooks.observation_change_state',
'data_product_post_upload': 'bhtom_base.bhtom_dataproducts.hooks.data_product_post_upload',
'data_product_post_save': 'bhtom_base.bhtom_dataproducts.hooks.data_product_post_save',
'multiple_data_products_post_save': 'bhtom_base.bhtom_dataproducts.hooks.multiple_data_products_post_save',
}

AUTO_THUMBNAILS = False
Expand Down
2 changes: 1 addition & 1 deletion bhtom2/signals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db.models.signals import pre_save
from django.dispatch import receiver
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target

from bhtom2.utils.bhtom_logger import BHTOMLogger
from bhtom2.utils.coordinate_utils import fill_galactic_coordinates
Expand Down
10 changes: 5 additions & 5 deletions bhtom2/templatetags/dataproduct_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
from plotly import offline
import plotly.graph_objs as go

from bhtom_dataproducts.forms import DataProductUploadForm
from bhtom_dataproducts.models import DataProduct, ReducedDatum
from bhtom_dataproducts.processors.data_serializers import SpectrumSerializer
from bhtom_observations.models import ObservationRecord
from bhtom_targets.models import Target
from bhtom_base.bhtom_dataproducts.forms import DataProductUploadForm
from bhtom_base.bhtom_dataproducts.models import DataProduct, ReducedDatum
from bhtom_base.bhtom_dataproducts.processors.data_serializers import SpectrumSerializer
from bhtom_base.bhtom_observations.models import ObservationRecord
from bhtom_base.bhtom_targets.models import Target

register = template.Library()

Expand Down
4 changes: 2 additions & 2 deletions bhtom2/tests/brokers/test_aavso.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from unittest.mock import patch

from django.test import TestCase
from bhtom_dataproducts.models import ReducedDatum
from bhtom_targets.models import Target
from bhtom_base.bhtom_dataproducts.models import ReducedDatum
from bhtom_base.bhtom_targets.models import Target

from bhtom2.brokers.aavso import AAVSOBroker
from bhtom2.brokers.bhtom_broker import LightcurveUpdateReport
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/tests/brokers/test_gaia_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from unittest.mock import patch

from django.test import TestCase
from bhtom_dataproducts.models import ReducedDatum
from bhtom_targets.models import Target
from bhtom_base.bhtom_dataproducts.models import ReducedDatum
from bhtom_base.bhtom_targets.models import Target

from bhtom2.brokers.bhtom_broker import LightcurveUpdateReport
from bhtom2.external_service.data_source_information import DataSource, TARGET_NAME_KEYS
Expand Down
4 changes: 2 additions & 2 deletions bhtom2/tests/brokers/test_ztf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from unittest.mock import patch

from django.test import TestCase
from bhtom_dataproducts.models import ReducedDatum
from bhtom_targets.models import Target
from bhtom_base.bhtom_dataproducts.models import ReducedDatum
from bhtom_base.bhtom_targets.models import Target

from bhtom2.external_service.data_source_information import DataSource, TARGET_NAME_KEYS
from bhtom2.brokers.bhtom_broker import LightcurveUpdateReport
Expand Down
2 changes: 1 addition & 1 deletion bhtom2/tests/dataproducts/test_last_jd.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.test import TestCase
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target
from typing import Optional

from bhtom2.dataproducts.last_jd import update_last_jd
Expand Down
2 changes: 1 addition & 1 deletion bhtom2/tests/harvesters/test_gaia_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.test import TestCase

from django.conf import settings
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target

from bhtom2.harvesters.gaia_alerts import fetch_alerts_csv, search_term_in_gaia_data, get, \
GaiaAlertsHarvester
Expand Down
2 changes: 1 addition & 1 deletion bhtom2/tests/utils/test_coordinate_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.test import TestCase
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target

from bhtom2.utils.coordinate_utils import fill_galactic_coordinates

Expand Down
2 changes: 1 addition & 1 deletion bhtom2/tests/utils/test_extinction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from unittest.mock import patch

from django.test import TestCase
from bhtom_targets.models import Target
from bhtom_base.bhtom_targets.models import Target

from bhtom2.utils.extinction import ogle_extinction

Expand Down
Loading

0 comments on commit 7b2f481

Please sign in to comment.