diff --git a/docs/examples/HDFN-demo.ipynb b/docs/examples/HDFN-demo.ipynb index 4d96fa36..c305f704 100644 --- a/docs/examples/HDFN-demo.ipynb +++ b/docs/examples/HDFN-demo.ipynb @@ -117,21 +117,53 @@ " ! {sys.executable} -m pip install install lxml" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Fetch templates and filter throughputs from `https://github.com/gbrammer/eazy-photoz`\n", + "\n", + "The [eazy-photoz](https://github.com/gbrammer/eazy-photoz) repository contains the default template sets and filter throughput curves. `eazy.fetch_eazy_photoz()` clones it into the `eazy` module directory (e.g., `.../lib/python3.10/site-packages/eazy`) and sets the variable `eazy.utils.DATA_PATH` to this path.\n", + "\n", + "There is no longer any need to make symbolic links to the `templates` directory with `eazy.symlink_eazy_templates()`. \n", + "\n", + "It is not required that the templates and filter files live in that directory. It is just used if your ``TEMPLATES_FILE`` and the templates it lists includes the `templates/` subdirectory and that is not found in the working directory.\n", + "\n", + "You can also override `eazy.utils.DATA_PATH` default by setting an `$EAZYCODE` environment variable." + ] + }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "eazy.utils.DATA_PATH = [...]/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages/eazy/data/eazy-photoz\n" + ] + } + ], "source": [ "# Now download templates etc.\n", "import eazy\n", - "if not os.path.exists(os.path.join(eazy.utils.DATA_PATH, 'eazy-photoz')):\n", + "print('eazy.utils.DATA_PATH = [...]/' + '/'.join(eazy.utils.DATA_PATH.split('/')[3:]))\n", + "\n", + "if not os.path.exists(eazy.utils.DATA_PATH):\n", " eazy.fetch_eazy_photoz()\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Module versions" + ] + }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 4, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -144,7 +176,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Fri Dec 13 09:34:45 2024\n", + "Fri Dec 13 10:30:57 2024\n", "\n", "3.10.16 | packaged by conda-forge | (main, Dec 5 2024, 14:20:01) [Clang 18.1.8 ]\n", "\n", @@ -152,14 +184,13 @@ " scipy : 1.13.1\n", " matplotlib : 3.9.4\n", " astropy : 6.1.7\n", - " eazy : 0.9.dev1+g4f8baa1.d20241213\n", + " eazy : 0.8.2.dev4+g5fb89ab\n", " prospect : 1.4.0\n", " grizli : 1.12.9\n" ] } ], "source": [ - "# Module versions\n", "import importlib\n", "import sys\n", "import time\n", @@ -178,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": { "id": "-lVEpuqz-HU7" }, @@ -207,7 +238,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": { "id": "jYILK5du-HU8" }, @@ -254,7 +285,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -307,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -349,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -400,7 +431,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:09<00:00, 2.04it/s]\n" + "100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:09<00:00, 2.05it/s]\n" ] }, { @@ -427,14 +458,14 @@ "Template 17: tweak_spline_age3.68_av1.0.fits (NZ=1).\n", "Template 18: tweak_spline_age6.07_av0.0.fits (NZ=1).\n", "Template 19: tweak_spline_age1.03_av0.0.fits (NZ=1).\n", - "Process templates: 10.114 s\n" + "Process templates: 10.039 s\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "511it [00:00, 1792.95it/s]\n" + "511it [00:00, 1728.89it/s]\n" ] } ], @@ -460,7 +491,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "metadata": { "id": "-2dKroi5-HU-" }, @@ -476,7 +507,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:36<00:00, 14.16it/s]\n" + "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:37<00:00, 13.51it/s]\n" ] }, { @@ -485,7 +516,7 @@ "text": [ "Compute best fits\n", "fit_best: 1.1 s (n_proc=1, NOBJ=3149)\n", - "Fit 37.3 s (n_proc=8, NOBJ=3203)\n", + "Fit 39.0 s (n_proc=8, NOBJ=3203)\n", "Iterative correction - zeropoint / template\n", "Iteration: 1\n" ] @@ -494,7 +525,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:36<00:00, 14.00it/s]\n" + "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:38<00:00, 13.34it/s]\n" ] }, { @@ -503,7 +534,7 @@ "text": [ "Compute best fits\n", "fit_best: 1.1 s (n_proc=1, NOBJ=3150)\n", - "Fit 37.8 s (n_proc=8, NOBJ=3203)\n", + "Fit 39.6 s (n_proc=8, NOBJ=3203)\n", "Iterative correction - zeropoint / template\n", "Iteration: 2\n" ] @@ -512,7 +543,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:36<00:00, 13.93it/s]\n" + "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:38<00:00, 13.40it/s]\n" ] }, { @@ -521,7 +552,7 @@ "text": [ "Compute best fits\n", "fit_best: 1.1 s (n_proc=1, NOBJ=3145)\n", - "Fit 38.0 s (n_proc=8, NOBJ=3203)\n", + "Fit 39.5 s (n_proc=8, NOBJ=3203)\n", "Iterative correction - zeropoint / template\n" ] }, @@ -591,7 +622,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -611,7 +642,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:36<00:00, 13.88it/s]\n" + "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511/511 [00:38<00:00, 13.15it/s]\n" ] }, { @@ -620,7 +651,7 @@ "text": [ "Compute best fits\n", "fit_best: 1.1 s (n_proc=1, NOBJ=3146)\n", - "Fit 38.1 s (n_proc=8, NOBJ=3207)\n" + "Fit 40.2 s (n_proc=8, NOBJ=3207)\n" ] } ], @@ -637,7 +668,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -665,7 +696,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -687,7 +718,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3146/3146 [00:11<00:00, 282.68it/s]\n" + "100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3146/3146 [00:11<00:00, 267.31it/s]\n" ] } ], @@ -710,7 +741,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -726,7 +757,7 @@ "Text(0, 0.5, '$(U-V)_0$')" ] }, - "execution_count": 17, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" }, @@ -757,7 +788,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -826,7 +857,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 16, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -904,7 +935,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 17, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -916,7 +947,7 @@ { "data": { "text/plain": [ - "OrderedDict([('version', ('0.9.dev1+g4f8baa1.d20241213', 'Eazy-py version')),\n", + "OrderedDict([('version', ('0.8.2.dev4+g5fb89ab', 'Eazy-py version')),\n", " ('prior', (True, 'Prior applied (templates/prior_K_TAO.dat)')),\n", " ('betprior', (True, 'Beta prior applied')),\n", " ('fitter', ('nnls', 'Optimization method for template fits')),\n", @@ -1042,7 +1073,7 @@ " ('RF_PADM', (2, 'max_err for RF fluxes'))])" ] }, - "execution_count": 20, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -1053,7 +1084,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 18, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -1130,7 +1161,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1195,7 +1226,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -1235,14 +1266,14 @@ "Set sys_err = 0.03 (positive=True)\n", "Template grid: templates/spline_templates_v2/tweak_spline.param (this may take some time)\n", "TemplateGrid: user-provided tempfilt_data\n", - "Process templates: 0.125 s\n" + "Process templates: 0.128 s\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "511it [00:00, 1801.12it/s]\n" + "511it [00:00, 1689.00it/s]\n" ] }, { @@ -1280,7 +1311,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -1332,7 +1363,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -1396,7 +1427,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 23, "metadata": { "code_folding": [] }, @@ -1434,124 +1465,11 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 24, "metadata": { "id": "v98qs9g-_SDN" }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Collecting dash\n", - " Downloading dash-2.18.2-py3-none-any.whl.metadata (10 kB)\n", - "Collecting jupyter-dash\n", - " Downloading jupyter_dash-0.4.2-py3-none-any.whl.metadata (3.6 kB)\n", - "Collecting Werkzeug==2.0.3\n", - " Downloading Werkzeug-2.0.3-py3-none-any.whl.metadata (4.5 kB)\n", - "Collecting Flask<3.1,>=1.0.4 (from dash)\n", - " Using cached flask-3.0.3-py3-none-any.whl.metadata (3.2 kB)\n", - "Collecting plotly>=5.0.0 (from dash)\n", - " Downloading plotly-5.24.1-py3-none-any.whl.metadata (7.3 kB)\n", - "Collecting dash-html-components==2.0.0 (from dash)\n", - " Downloading dash_html_components-2.0.0-py3-none-any.whl.metadata (3.8 kB)\n", - "Collecting dash-core-components==2.0.0 (from dash)\n", - " Downloading dash_core_components-2.0.0-py3-none-any.whl.metadata (2.9 kB)\n", - "Collecting dash-table==5.0.0 (from dash)\n", - " Downloading dash_table-5.0.0-py3-none-any.whl.metadata (2.4 kB)\n", - "Requirement already satisfied: importlib-metadata in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from dash) (8.5.0)\n", - "Requirement already satisfied: typing-extensions>=4.1.1 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from dash) (4.12.2)\n", - "Requirement already satisfied: requests in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from dash) (2.32.3)\n", - "Collecting retrying (from dash)\n", - " Downloading retrying-1.3.4-py3-none-any.whl.metadata (6.9 kB)\n", - "Requirement already satisfied: nest-asyncio in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from dash) (1.6.0)\n", - "Requirement already satisfied: setuptools in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from dash) (75.6.0)\n", - "Requirement already satisfied: ipython in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from jupyter-dash) (8.30.0)\n", - "Requirement already satisfied: ipykernel in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from jupyter-dash) (6.29.5)\n", - "Collecting ansi2html (from jupyter-dash)\n", - " Downloading ansi2html-1.9.2-py3-none-any.whl.metadata (3.7 kB)\n", - "INFO: pip is looking at multiple versions of flask to determine which version is compatible with other requirements. This could take a while.\n", - "Collecting Flask<3.1,>=1.0.4 (from dash)\n", - " Downloading flask-3.0.2-py3-none-any.whl.metadata (3.6 kB)\n", - " Downloading flask-3.0.1-py3-none-any.whl.metadata (3.6 kB)\n", - " Downloading flask-3.0.0-py3-none-any.whl.metadata (3.6 kB)\n", - " Downloading flask-2.3.3-py3-none-any.whl.metadata (3.6 kB)\n", - " Downloading Flask-2.3.2-py3-none-any.whl.metadata (3.7 kB)\n", - " Downloading Flask-2.3.1-py3-none-any.whl.metadata (3.7 kB)\n", - " Downloading Flask-2.3.0-py3-none-any.whl.metadata (3.7 kB)\n", - "INFO: pip is still looking at multiple versions of flask to determine which version is compatible with other requirements. This could take a while.\n", - " Downloading Flask-2.2.5-py3-none-any.whl.metadata (3.9 kB)\n", - " Downloading Flask-2.2.4-py3-none-any.whl.metadata (3.9 kB)\n", - " Downloading Flask-2.2.3-py3-none-any.whl.metadata (3.9 kB)\n", - " Downloading Flask-2.2.2-py3-none-any.whl.metadata (3.9 kB)\n", - " Downloading Flask-2.2.1-py3-none-any.whl.metadata (3.9 kB)\n", - "INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.\n", - " Downloading Flask-2.2.0-py3-none-any.whl.metadata (3.9 kB)\n", - " Downloading Flask-2.1.3-py3-none-any.whl.metadata (3.9 kB)\n", - "Requirement already satisfied: Jinja2>=3.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from Flask<3.1,>=1.0.4->dash) (3.1.4)\n", - "Requirement already satisfied: itsdangerous>=2.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from Flask<3.1,>=1.0.4->dash) (2.2.0)\n", - "Requirement already satisfied: click>=8.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from Flask<3.1,>=1.0.4->dash) (8.1.7)\n", - "Collecting tenacity>=6.2.0 (from plotly>=5.0.0->dash)\n", - " Downloading tenacity-9.0.0-py3-none-any.whl.metadata (1.2 kB)\n", - "Requirement already satisfied: packaging in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from plotly>=5.0.0->dash) (24.2)\n", - "Requirement already satisfied: zipp>=3.20 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from importlib-metadata->dash) (3.21.0)\n", - "Requirement already satisfied: appnope in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (0.1.4)\n", - "Requirement already satisfied: comm>=0.1.1 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (0.2.2)\n", - "Requirement already satisfied: debugpy>=1.6.5 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (1.8.10)\n", - "Requirement already satisfied: jupyter-client>=6.1.12 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (8.6.3)\n", - "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (5.7.2)\n", - "Requirement already satisfied: matplotlib-inline>=0.1 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (0.1.7)\n", - "Requirement already satisfied: psutil in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (6.1.0)\n", - "Requirement already satisfied: pyzmq>=24 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (26.2.0)\n", - "Requirement already satisfied: tornado>=6.1 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (6.4.2)\n", - "Requirement already satisfied: traitlets>=5.4.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipykernel->jupyter-dash) (5.14.3)\n", - "Requirement already satisfied: decorator in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (5.1.1)\n", - "Requirement already satisfied: exceptiongroup in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (1.2.2)\n", - "Requirement already satisfied: jedi>=0.16 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (0.19.2)\n", - "Requirement already satisfied: pexpect>4.3 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (4.9.0)\n", - "Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (3.0.48)\n", - "Requirement already satisfied: pygments>=2.4.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (2.18.0)\n", - "Requirement already satisfied: stack_data in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from ipython->jupyter-dash) (0.6.3)\n", - "Requirement already satisfied: charset_normalizer<4,>=2 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from requests->dash) (3.4.0)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from requests->dash) (3.10)\n", - "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from requests->dash) (2.2.3)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from requests->dash) (2024.8.30)\n", - "Requirement already satisfied: six>=1.7.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from retrying->dash) (1.17.0)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.4 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from jedi>=0.16->ipython->jupyter-dash) (0.8.4)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from Jinja2>=3.0->Flask<3.1,>=1.0.4->dash) (3.0.2)\n", - "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from jupyter-client>=6.1.12->ipykernel->jupyter-dash) (2.9.0.post0)\n", - "Requirement already satisfied: platformdirs>=2.5 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel->jupyter-dash) (4.3.6)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from pexpect>4.3->ipython->jupyter-dash) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython->jupyter-dash) (0.2.13)\n", - "Requirement already satisfied: executing>=1.2.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from stack_data->ipython->jupyter-dash) (2.1.0)\n", - "Requirement already satisfied: asttokens>=2.1.0 in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from stack_data->ipython->jupyter-dash) (3.0.0)\n", - "Requirement already satisfied: pure_eval in /Users/gbrammer/miniconda3/envs/py310-eazytest/lib/python3.10/site-packages (from stack_data->ipython->jupyter-dash) (0.2.3)\n", - "Downloading Werkzeug-2.0.3-py3-none-any.whl (289 kB)\n", - "Downloading dash-2.18.2-py3-none-any.whl (7.8 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.8/7.8 MB\u001b[0m \u001b[31m18.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", - "\u001b[?25hDownloading dash_core_components-2.0.0-py3-none-any.whl (3.8 kB)\n", - "Downloading dash_html_components-2.0.0-py3-none-any.whl (4.1 kB)\n", - "Downloading dash_table-5.0.0-py3-none-any.whl (3.9 kB)\n", - "Downloading jupyter_dash-0.4.2-py3-none-any.whl (23 kB)\n", - "Downloading Flask-2.1.3-py3-none-any.whl (95 kB)\n", - "Downloading plotly-5.24.1-py3-none-any.whl (19.1 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m19.1/19.1 MB\u001b[0m \u001b[31m24.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", - "\u001b[?25hDownloading ansi2html-1.9.2-py3-none-any.whl (17 kB)\n", - "Downloading retrying-1.3.4-py3-none-any.whl (11 kB)\n", - "Downloading tenacity-9.0.0-py3-none-any.whl (28 kB)\n", - "Installing collected packages: dash-table, dash-html-components, dash-core-components, Werkzeug, tenacity, retrying, ansi2html, plotly, Flask, dash, jupyter-dash\n", - " Attempting uninstall: Werkzeug\n", - " Found existing installation: Werkzeug 3.1.3\n", - " Uninstalling Werkzeug-3.1.3:\n", - " Successfully uninstalled Werkzeug-3.1.3\n", - " Attempting uninstall: Flask\n", - " Found existing installation: Flask 3.1.0\n", - " Uninstalling Flask-3.1.0:\n", - " Successfully uninstalled Flask-3.1.0\n", - "Successfully installed Flask-2.1.3 Werkzeug-2.0.3 ansi2html-1.9.2 dash-2.18.2 dash-core-components-2.0.0 dash-html-components-2.0.0 dash-table-5.0.0 jupyter-dash-0.4.2 plotly-5.24.1 retrying-1.3.4 tenacity-9.0.0\n" - ] - } - ], + "outputs": [], "source": [ "try:\n", " import jupyter_dash\n", @@ -1561,7 +1479,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 25, "metadata": { "code_folding": [], "colab": { @@ -1588,7 +1506,7 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -1643,7 +1561,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ diff --git a/eazy/__init__.py b/eazy/__init__.py index f1f3d446..e9f2cd5c 100644 --- a/eazy/__init__.py +++ b/eazy/__init__.py @@ -55,18 +55,6 @@ def fetch_eazy_photoz(): os.system(f'git clone {git_url}') print(f'cloning {git_url} to {data_path}') - if not os.path.exists('filters'): - os.symlink(os.path.join(data_path, 'eazy-photoz','filters'), - 'filters') - - if not os.path.exists('templates'): - os.symlink(os.path.join(data_path, 'eazy-photoz','templates'), - 'templates') - - if not os.path.exists('hdfn_fs99'): - os.symlink(os.path.join(data_path, 'eazy-photoz','inputs'), - 'hdfn_fs99') - # Back to working directory os.chdir(current_path) @@ -103,6 +91,7 @@ def symlink_eazy_inputs(path='$EAZYCODE', get_hdfn_test_catalog=False, copy=Fals directory are created in the current working directory (`./`). """ + from .utils import DATA_PATH if path.startswith('$'): path = os.getenv(path) @@ -111,7 +100,8 @@ def symlink_eazy_inputs(path='$EAZYCODE', get_hdfn_test_catalog=False, copy=Fals if path is None: # Use the code attached to the repository - path = os.path.join(os.path.dirname(__file__), 'data/') + # path = os.path.join(os.path.dirname(__file__), 'data/') + path = DATA_PATH if not os.path.exists(os.path.join(path, 'templates')): fetch_eazy_photoz() diff --git a/eazy/tests/test_filters.py b/eazy/tests/test_filters.py index 1fb37fb6..68109150 100644 --- a/eazy/tests/test_filters.py +++ b/eazy/tests/test_filters.py @@ -5,7 +5,7 @@ from astropy.utils.exceptions import AstropyWarning -from .. import filters, fetch_eazy_photoz +from .. import filters, fetch_eazy_photoz, utils def test_array_filter(): """ @@ -45,8 +45,10 @@ def test_data_path(): """ Data path """ - path = os.path.join(os.path.dirname(__file__), '../data/') - assert(os.path.exists(path)) + # path = os.path.join(os.path.dirname(__file__), '../data/') + path = utils.DATA_PATH + + # assert(os.path.exists(path)) if not os.path.exists(os.path.join(path, 'filters', 'FILTER.RES.latest')): fetch_eazy_photoz() diff --git a/eazy/tests/test_param.py b/eazy/tests/test_param.py index 979ae6cf..a4ec570c 100644 --- a/eazy/tests/test_param.py +++ b/eazy/tests/test_param.py @@ -1,13 +1,14 @@ import os from .. import param +from .. import utils def data_path(): """ Data path """ path = os.path.join(os.path.dirname(__file__), '../data/') - return path + return os.path.join(path) def test_param_file(): diff --git a/eazy/tests/test_templates.py b/eazy/tests/test_templates.py index 4e92a3ea..b32e9ccb 100644 --- a/eazy/tests/test_templates.py +++ b/eazy/tests/test_templates.py @@ -10,7 +10,9 @@ def test_data_path(): """ Data path """ - path = os.path.join(os.path.dirname(__file__), '../data/') + # path = os.path.join(os.path.dirname(__file__), '../data/') + path = utils.DATA_PATH + assert(os.path.exists(path)) return path diff --git a/eazy/utils.py b/eazy/utils.py index cfeefea2..2e1d36e6 100644 --- a/eazy/utils.py +++ b/eazy/utils.py @@ -46,11 +46,13 @@ def set_data_path(path='$EAZYCODE'): if path is None: # Use the code attached to the repository - path = os.path.join(os.path.dirname(__file__), 'data/') - + path = os.path.join(os.path.dirname(__file__), 'data') + if not os.path.exists(os.path.join(path, 'templates')): + path = os.path.join(path, 'eazy-photoz') + DATA_PATH = path return path - + set_data_path() def bool_param(value, false_values=FALSE_VALUES, true_values=TRUE_VALUES, which='false', check_both=True):