diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5c887a..5307cc4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,7 +48,7 @@ repos: # Analyze the code style and report code that doesn't adhere. - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 24.10.0 hooks: - id: black-jupyter name: Format code using black diff --git a/docs/notebooks/adler_phasecurve_example.ipynb b/docs/notebooks/adler_phasecurve_example.ipynb index 6e64763..4197f1b 100644 --- a/docs/notebooks/adler_phasecurve_example.ipynb +++ b/docs/notebooks/adler_phasecurve_example.ipynb @@ -16,7 +16,7 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", "\n", "import numpy as np\n", @@ -351,7 +351,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/docs/notebooks/colour_functions_example.ipynb b/docs/notebooks/colour_functions_example.ipynb index ec57c97..1882c00 100644 --- a/docs/notebooks/colour_functions_example.ipynb +++ b/docs/notebooks/colour_functions_example.ipynb @@ -17,8 +17,8 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", - "from adler.dataclasses.AdlerData import AdlerData\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerData import AdlerData\n", "from adler.science.PhaseCurve import PhaseCurve\n", "from adler.science.Colour import col_obs_ref\n", "from adler.utilities.plotting_utilities import plot_errorbar\n", @@ -282,7 +282,7 @@ "\n", "# store running colour parameters as a dataframe\n", "df_col = pd.DataFrame(col_dict_list)\n", - "df_col = pd.concat([df_obs, df_col], axis=1)\n", + "df_col = df_col.merge(df_obs, on=x_plot)\n", "\n", "ax1.set_xlabel(x_plot)\n", "ax1.set_ylabel(y_plot)\n", @@ -361,7 +361,7 @@ { "cell_type": "code", "execution_count": null, - "id": "605a043a", + "id": "30e90de5-e50b-4339-a027-7b2165a6b664", "metadata": {}, "outputs": [], "source": [] @@ -383,7 +383,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.10.14" } }, "nbformat": 4, diff --git a/docs/notebooks/outlier_detection_example.ipynb b/docs/notebooks/outlier_detection_example.ipynb index 984375d..f3af189 100644 --- a/docs/notebooks/outlier_detection_example.ipynb +++ b/docs/notebooks/outlier_detection_example.ipynb @@ -16,9 +16,9 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", - "from adler.dataclasses.AdlerData import AdlerData\n", + "from adler.objectdata.AdlerData import AdlerData\n", "import adler.utilities.science_utilities as utils\n", "\n", "import numpy as np\n", @@ -296,7 +296,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/docs/notebooks/plotting_utilities_example.ipynb b/docs/notebooks/plotting_utilities_example.ipynb index c18cccd..68536c8 100644 --- a/docs/notebooks/plotting_utilities_example.ipynb +++ b/docs/notebooks/plotting_utilities_example.ipynb @@ -16,7 +16,7 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", "from adler.utilities.plotting_utilities import plot_errorbar\n", "\n", @@ -251,7 +251,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/notebooks/adler_demo/adler_demo.ipynb b/notebooks/adler_demo/adler_demo.ipynb index 5694d63..f8fed9c 100644 --- a/notebooks/adler_demo/adler_demo.ipynb +++ b/notebooks/adler_demo/adler_demo.ipynb @@ -15,7 +15,7 @@ }, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", "from adler.utilities.plotting_utilities import plot_errorbar\n", "import adler.utilities.science_utilities as sci_utils\n", @@ -568,9 +568,9 @@ ], "metadata": { "kernelspec": { - "display_name": "adler-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "adler-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -582,7 +582,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/notebooks/adler_examples.ipynb b/notebooks/adler_examples.ipynb index 6c4d4f1..d29d232 100644 --- a/notebooks/adler_examples.ipynb +++ b/notebooks/adler_examples.ipynb @@ -7,7 +7,7 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", "\n", "import numpy as np\n", @@ -324,9 +324,9 @@ ], "metadata": { "kernelspec": { - "display_name": "adler-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "adler-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/adlerdata_in_and_out.ipynb b/notebooks/adlerdata_in_and_out.ipynb index 22b68c5..344ac69 100644 --- a/notebooks/adlerdata_in_and_out.ipynb +++ b/notebooks/adlerdata_in_and_out.ipynb @@ -10,8 +10,8 @@ "import pandas as pd\n", "import sqlite3\n", "\n", - "from adler.dataclasses.AdlerData import AdlerData\n", - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerData import AdlerData\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.utilities.tests_utilities import get_test_data_filepath" ] }, diff --git a/notebooks/colour_functions_demo.ipynb b/notebooks/colour_functions_demo.ipynb index 902f481..48d43d0 100644 --- a/notebooks/colour_functions_demo.ipynb +++ b/notebooks/colour_functions_demo.ipynb @@ -27,8 +27,8 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", - "from adler.dataclasses.AdlerData import AdlerData\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerData import AdlerData\n", "from adler.science.PhaseCurve import PhaseCurve\n", "from adler.science.Colour import col_obs_ref\n", "from adler.utilities.plotting_utilities import plot_errorbar\n", @@ -369,9 +369,9 @@ ], "metadata": { "kernelspec": { - "display_name": "adler-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "adler-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -383,7 +383,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/notebooks/colour_functions_testing.ipynb b/notebooks/colour_functions_testing.ipynb index b1a2947..212fa97 100644 --- a/notebooks/colour_functions_testing.ipynb +++ b/notebooks/colour_functions_testing.ipynb @@ -27,8 +27,8 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", - "from adler.dataclasses.AdlerData import AdlerData\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerData import AdlerData\n", "from adler.science.PhaseCurve import PhaseCurve\n", "from adler.science.Colour import col_obs_ref\n", "from adler.utilities.plotting_utilities import plot_errorbar\n", @@ -2035,9 +2035,9 @@ ], "metadata": { "kernelspec": { - "display_name": "adler-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "adler-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -2049,7 +2049,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.10.13" } }, "nbformat": 4, diff --git a/notebooks/outlier_detection.ipynb b/notebooks/outlier_detection.ipynb index 3d38b6b..2234d64 100644 --- a/notebooks/outlier_detection.ipynb +++ b/notebooks/outlier_detection.ipynb @@ -7,9 +7,9 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", - "from adler.dataclasses.AdlerData import AdlerData\n", + "from adler.objectdata.AdlerData import AdlerData\n", "import adler.utilities.science_utilities as utils\n", "\n", "import numpy as np\n", @@ -275,9 +275,9 @@ ], "metadata": { "kernelspec": { - "display_name": "adler-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "adler-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/plotting_utilities.ipynb b/notebooks/plotting_utilities.ipynb index 3b1071c..b371cf4 100644 --- a/notebooks/plotting_utilities.ipynb +++ b/notebooks/plotting_utilities.ipynb @@ -27,7 +27,7 @@ "metadata": {}, "outputs": [], "source": [ - "from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid\n", + "from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid\n", "from adler.science.PhaseCurve import PhaseCurve\n", "from adler.utilities.plotting_utilities import plot_errorbar\n", "\n", @@ -246,9 +246,9 @@ ], "metadata": { "kernelspec": { - "display_name": "adler-dev", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "adler-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { diff --git a/src/adler/__init__.py b/src/adler/__init__.py index 6d46c05..827ef62 100644 --- a/src/adler/__init__.py +++ b/src/adler/__init__.py @@ -1,4 +1,4 @@ -from . import dataclasses +from . import objectdata from . import science from . import utilities from . import lasair diff --git a/src/adler/adler.py b/src/adler/adler.py index 3622867..4efe0a2 100644 --- a/src/adler/adler.py +++ b/src/adler/adler.py @@ -7,8 +7,8 @@ import matplotlib.gridspec as gridspec import os -from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid -from adler.dataclasses.AdlerData import AdlerData +from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid +from adler.objectdata.AdlerData import AdlerData from adler.science.PhaseCurve import PhaseCurve from adler.science.Colour import col_obs_ref from adler.utilities.AdlerCLIArguments import AdlerCLIArguments @@ -102,9 +102,9 @@ def runAdler(cli_args): logger.info("load previously classified observations: {}".format(save_file)) _df_obs = pd.read_csv(save_file, index_col=0) df_obs = df_obs.merge(_df_obs, on=["diaSourceId", "midPointMjdTai"], how="left") - df_obs.loc[ - pd.isnull(df_obs["outlier_y"]), "outlier_y" - ] = False # ensure that classifications exist (nan entries can only be false?). Weird behaviour here for g filter, is it to do with when new g obs appear relative to r/i etc? + df_obs.loc[pd.isnull(df_obs["outlier_y"]), "outlier_y"] = ( + False # ensure that classifications exist (nan entries can only be false?). Weird behaviour here for g filter, is it to do with when new g obs appear relative to r/i etc? + ) df_obs = df_obs.rename({"outlier_y": "outlier"}, axis=1) df_obs = df_obs.drop("outlier_x", axis=1) else: diff --git a/src/adler/dataclasses/AdlerData.py b/src/adler/objectdata/AdlerData.py similarity index 100% rename from src/adler/dataclasses/AdlerData.py rename to src/adler/objectdata/AdlerData.py diff --git a/src/adler/dataclasses/AdlerPlanetoid.py b/src/adler/objectdata/AdlerPlanetoid.py similarity index 98% rename from src/adler/dataclasses/AdlerPlanetoid.py rename to src/adler/objectdata/AdlerPlanetoid.py index 162af1b..0095099 100644 --- a/src/adler/dataclasses/AdlerPlanetoid.py +++ b/src/adler/objectdata/AdlerPlanetoid.py @@ -4,11 +4,11 @@ import logging import json -from adler.dataclasses.Observations import Observations -from adler.dataclasses.MPCORB import MPCORB -from adler.dataclasses.SSObject import SSObject -from adler.dataclasses.AdlerData import AdlerData -from adler.dataclasses.dataclass_utilities import get_data_table +from adler.objectdata.Observations import Observations +from adler.objectdata.MPCORB import MPCORB +from adler.objectdata.SSObject import SSObject +from adler.objectdata.AdlerData import AdlerData +from adler.objectdata.objectdata_utilities import get_data_table logger = logging.getLogger(__name__) diff --git a/src/adler/dataclasses/MPCORB.py b/src/adler/objectdata/MPCORB.py similarity index 98% rename from src/adler/dataclasses/MPCORB.py rename to src/adler/objectdata/MPCORB.py index 237df1d..d4a7880 100644 --- a/src/adler/dataclasses/MPCORB.py +++ b/src/adler/objectdata/MPCORB.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from adler.dataclasses.dataclass_utilities import get_from_table, get_from_dictionary +from adler.objectdata.objectdata_utilities import get_from_table, get_from_dictionary MPCORB_KEYS = { "mpcDesignation": str, diff --git a/src/adler/dataclasses/Observations.py b/src/adler/objectdata/Observations.py similarity index 99% rename from src/adler/dataclasses/Observations.py rename to src/adler/objectdata/Observations.py index a76a472..0961b2a 100644 --- a/src/adler/dataclasses/Observations.py +++ b/src/adler/objectdata/Observations.py @@ -1,7 +1,7 @@ from dataclasses import dataclass, field import numpy as np -from adler.dataclasses.dataclass_utilities import get_from_table, get_from_dictionary +from adler.objectdata.objectdata_utilities import get_from_table, get_from_dictionary OBSERVATIONS_KEYS = { "diaSourceId": np.ndarray, diff --git a/src/adler/dataclasses/SSObject.py b/src/adler/objectdata/SSObject.py similarity index 98% rename from src/adler/dataclasses/SSObject.py rename to src/adler/objectdata/SSObject.py index c0ba468..2388889 100644 --- a/src/adler/dataclasses/SSObject.py +++ b/src/adler/objectdata/SSObject.py @@ -1,7 +1,7 @@ from dataclasses import dataclass, field import numpy as np -from adler.dataclasses.dataclass_utilities import get_from_table, get_from_dictionary +from adler.objectdata.objectdata_utilities import get_from_table, get_from_dictionary SSO_KEYS = { "discoverySubmissionDate": float, diff --git a/src/adler/dataclasses/__init__.py b/src/adler/objectdata/__init__.py similarity index 77% rename from src/adler/dataclasses/__init__.py rename to src/adler/objectdata/__init__.py index 9b7a7df..9e2f367 100644 --- a/src/adler/dataclasses/__init__.py +++ b/src/adler/objectdata/__init__.py @@ -1,6 +1,6 @@ from . import AdlerData from . import Observations -from . import dataclass_utilities +from . import objectdata_utilities from . import MPCORB from . import AdlerPlanetoid from . import SSObject diff --git a/src/adler/dataclasses/dataclass_utilities.py b/src/adler/objectdata/objectdata_utilities.py similarity index 100% rename from src/adler/dataclasses/dataclass_utilities.py rename to src/adler/objectdata/objectdata_utilities.py diff --git a/tests/adler/dataclasses/test_AdlerData.py b/tests/adler/objectdata/test_AdlerData.py similarity index 99% rename from tests/adler/dataclasses/test_AdlerData.py rename to tests/adler/objectdata/test_AdlerData.py index 6c1e1e2..dd4af55 100644 --- a/tests/adler/dataclasses/test_AdlerData.py +++ b/tests/adler/objectdata/test_AdlerData.py @@ -6,7 +6,7 @@ from numpy.testing import assert_array_equal -from adler.dataclasses.AdlerData import AdlerData +from adler.objectdata.AdlerData import AdlerData from adler.utilities.tests_utilities import get_test_data_filepath # setting up the AdlerData object to be used for testing diff --git a/tests/adler/dataclasses/test_AdlerPlanetoid.py b/tests/adler/objectdata/test_AdlerPlanetoid.py similarity index 99% rename from tests/adler/dataclasses/test_AdlerPlanetoid.py rename to tests/adler/objectdata/test_AdlerPlanetoid.py index 992925a..4716b64 100644 --- a/tests/adler/dataclasses/test_AdlerPlanetoid.py +++ b/tests/adler/objectdata/test_AdlerPlanetoid.py @@ -3,7 +3,7 @@ from numpy.testing import assert_almost_equal from adler.utilities.tests_utilities import get_test_data_filepath -from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid +from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid ssoid = 8268570668335894776 diff --git a/tests/adler/dataclasses/test_MPCORB.py b/tests/adler/objectdata/test_MPCORB.py similarity index 94% rename from tests/adler/dataclasses/test_MPCORB.py rename to tests/adler/objectdata/test_MPCORB.py index ee43b3d..10591d1 100644 --- a/tests/adler/dataclasses/test_MPCORB.py +++ b/tests/adler/objectdata/test_MPCORB.py @@ -1,8 +1,8 @@ from numpy.testing import assert_almost_equal import numpy as np -from adler.dataclasses.MPCORB import MPCORB -from adler.dataclasses.dataclass_utilities import get_data_table +from adler.objectdata.MPCORB import MPCORB +from adler.objectdata.objectdata_utilities import get_data_table from adler.utilities.tests_utilities import get_test_data_filepath diff --git a/tests/adler/dataclasses/test_Observations.py b/tests/adler/objectdata/test_Observations.py similarity index 97% rename from tests/adler/dataclasses/test_Observations.py rename to tests/adler/objectdata/test_Observations.py index 72edd4d..830011e 100644 --- a/tests/adler/dataclasses/test_Observations.py +++ b/tests/adler/objectdata/test_Observations.py @@ -1,8 +1,8 @@ from numpy.testing import assert_almost_equal import numpy as np -from adler.dataclasses.Observations import Observations -from adler.dataclasses.dataclass_utilities import get_data_table +from adler.objectdata.Observations import Observations +from adler.objectdata.objectdata_utilities import get_data_table from adler.utilities.tests_utilities import get_test_data_filepath diff --git a/tests/adler/dataclasses/test_SSObject.py b/tests/adler/objectdata/test_SSObject.py similarity index 95% rename from tests/adler/dataclasses/test_SSObject.py rename to tests/adler/objectdata/test_SSObject.py index b6cb05b..f99eb78 100644 --- a/tests/adler/dataclasses/test_SSObject.py +++ b/tests/adler/objectdata/test_SSObject.py @@ -3,8 +3,8 @@ import numpy as np from adler.utilities.tests_utilities import get_test_data_filepath -from adler.dataclasses.dataclass_utilities import get_data_table -from adler.dataclasses.SSObject import SSObject +from adler.objectdata.objectdata_utilities import get_data_table +from adler.objectdata.SSObject import SSObject def test_construct_SSObject_from_data_table(): diff --git a/tests/adler/dataclasses/test_dataclass_utilities.py b/tests/adler/objectdata/test_objectdata_utilities.py similarity index 93% rename from tests/adler/dataclasses/test_dataclass_utilities.py rename to tests/adler/objectdata/test_objectdata_utilities.py index b087e0e..25fdb04 100644 --- a/tests/adler/dataclasses/test_dataclass_utilities.py +++ b/tests/adler/objectdata/test_objectdata_utilities.py @@ -4,9 +4,9 @@ from pandas.testing import assert_frame_equal from numpy.testing import assert_equal -from adler.dataclasses.dataclass_utilities import get_data_table -from adler.dataclasses.dataclass_utilities import get_from_table -from adler.dataclasses.dataclass_utilities import check_value_populated +from adler.objectdata.objectdata_utilities import get_data_table +from adler.objectdata.objectdata_utilities import get_from_table +from adler.objectdata.objectdata_utilities import check_value_populated from adler.utilities.tests_utilities import get_test_data_filepath diff --git a/tests/adler/science/test_Colour.py b/tests/adler/science/test_Colour.py index 89813f3..307eb68 100644 --- a/tests/adler/science/test_Colour.py +++ b/tests/adler/science/test_Colour.py @@ -7,8 +7,8 @@ from adler.science.Colour import col_obs_ref from adler.utilities.tests_utilities import get_test_data_filepath -from adler.dataclasses.AdlerPlanetoid import AdlerPlanetoid -from adler.dataclasses.AdlerData import AdlerData +from adler.objectdata.AdlerPlanetoid import AdlerPlanetoid +from adler.objectdata.AdlerData import AdlerData from adler.science.PhaseCurve import PhaseCurve from adler.utilities.science_utilities import get_df_obs_filt