diff --git a/autoui_widget_viewer.ipynb b/autoui_widget_viewer.ipynb index 22b1b6a7..a41ff435 100644 --- a/autoui_widget_viewer.ipynb +++ b/autoui_widget_viewer.ipynb @@ -7,8 +7,9 @@ "metadata": {}, "outputs": [], "source": [ - "from ipyautoui import AutoUi\n", - "import ipywidgets as ipw" + "from pathlib import Path\n", + "\n", + "from astropy.table import Table" ] }, { @@ -29,6 +30,8 @@ "metadata": {}, "outputs": [], "source": [ + "from stellarphot import SourceListData\n", + "\n", "from stellarphot.settings import (\n", " Camera, \n", " LoggingSettings,\n", @@ -36,7 +39,9 @@ " PhotometryApertures, \n", " Exoplanet, \n", " PhotometrySettings, \n", + " PhotometryOptions,\n", " PassbandMap,\n", + " SourceLocationSettings,\n", ")\n", "from stellarphot.settings.models import _extract_short_description\n", "from stellarphot.settings import ui_generator\n", @@ -46,214 +51,125 @@ { "cell_type": "code", "execution_count": null, - "id": "ac061641-c4bd-4425-adfd-531cc311ce00", - "metadata": {}, - "outputs": [], - "source": [ - "classes = [Camera, Observatory, PhotometryApertures, LoggingSettings, PassbandMap, Exoplanet, PhotometrySettings]\n", - "\n", - "uis = [ui_generator(c) for c in classes]\n", - "\n", - "# for ui in uis:\n", - "# ui.show_validation = False\n", - "# ui.show_null = True\n", - "# ui.description = _extract_short_description(ui.description)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3d26814b-775e-4f72-b535-ebce1b23e5d6", - "metadata": {}, - "outputs": [], - "source": [ - "tabs = ipw.Tab()\n", - "tabs.children = uis\n", - "tabs.titles = [c.__name__ for c in classes]\n", - "tabs" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "51403657-ca4e-4615-bc59-65b93e3fad6d", - "metadata": {}, - "outputs": [], - "source": [ - "ui = uis[-1]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1c6610f7-1973-4a9b-b755-49bbacac7e78", + "id": "c6dab0a9-e02c-4f06-a1da-4a6349ac1796", "metadata": {}, "outputs": [], "source": [ - "ui.value" + "sl = SourceListData(Table({'star_id': [1, 2], 'ra': [0.1, 0.2], 'dec': [12.3, 12.2]}, units=[None, \"degree\", \"degree\"]))" ] }, { "cell_type": "code", "execution_count": null, - "id": "4292410c-206d-4a1b-a30c-b227f22517d7", + "id": "9234124e-bf47-45cf-ad8b-0531d60bdcda", "metadata": {}, "outputs": [], "source": [ - "ui_generator(PhotometrySettings)" + "sl.write(\"source_list_file.ecsv\")" ] }, { "cell_type": "code", "execution_count": null, - "id": "b00ce1bf-6406-495c-94eb-9eae16b9ded3", - "metadata": {}, - "outputs": [], - "source": [ - "ui.show_validation = False\n", - "ui.show_null = True" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dbc072a0-1f35-43ea-9721-ec9b30065b59", + "id": "ac061641-c4bd-4425-adfd-531cc311ce00", "metadata": {}, "outputs": [], "source": [ - "uis[-1].value[\"your_filter_names_to_aavso\"][:1]" + "classes = [Camera, Observatory, PassbandMap, PhotometryApertures, SourceLocationSettings, PhotometryOptions, LoggingSettings]\n", + "\n", + "uis = [ui_generator(c) for c in classes]\n", + "\n", + "for ui in uis:\n", + " ui.path = Path(ui.title + \".json\")" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "b4c579f6-6b1d-4765-bfe8-2db766ad7988", + "cell_type": "markdown", + "id": "93beccb6-9ec0-4a78-bf24-68bfa18f0e03", "metadata": {}, - "outputs": [], "source": [ - "pbm = PassbandMap(your_filter_names_to_aavso=uis[-1].value[\"your_filter_names_to_aavso\"])" + "# Instructions\n", + "\n", + "1. Guidance about entering some of the values that are needed is in the section \"Entering values\"\n", + "2. After that, there are two sections wehere you will try entring some settings. Please try each and take notes on what like/don't like/are confused about.\n", + "3. In each, click the green save button to make a json file with those settings.\n", + "4. When you are done, please email your comments and any json files made by this notebook." ] }, { - "cell_type": "code", - "execution_count": null, - "id": "54589e56-2f09-434f-9703-ea391eaf1bc7", + "cell_type": "markdown", + "id": "f24eb5a3-308b-43c6-920e-cfccb1623ac1", "metadata": {}, - "outputs": [], "source": [ - "print(pbm.model_dump_json(indent=2))" + "## Entering values\n", + "\n", + "+ **Values with units**\n", + " + Some values, like gain for the camera, needs units. Enter those by typing the number and units into the box, e.g. \"1.5 electron / adu\".\n", + " + In the observatory section, enter latitude and longitude as decimal degrees, and include a unit, e.g. meter, in the elevation.\n", + "+ **Passband map**: There are three buttons to push to get to the point where you can enter a filter and choose the AAVSO filter it matches to. See the screenshot below. A good test value here is to put in `rp` for \"your\" filter, and choose `SR` as the corresponding AAVSO filter.\n", + "\n", + "![Passband map](https://ucec9eb879fd3f8c32810710f934.previews.dropboxusercontent.com/p/thumb/ACNK15i8h_lDgQcao5KHQq-2IVdjZrJVTmYgxBcZYHXp_Ca643pb7sif5olc4-wJ-ngmZb0RdMyTZReGLhOgOncheXfG3ESHz08GzuKcEVM3b1e-TluQXgTkYqZJhQ4m0WoSFuGPHx2cRPh8ketYU-xU0EnJ16XF4OHbboNvKSoA_Q7dXw6kQltqGfCmrQGUFoj2IQ0nWsxis6-YFmZXOeURAMSk7jsK51r0O1rRO1QAMfyefubG1P3GhKXgL35Pjd3FJs4XeoG8kCIU94-r41nq9azRVHlTUYqFbP85uP47u2GR6bL8tIBLHOnMrOcrlO30YAJFSjom0atwvii0Xydb1cPIqEwHooCkyY1JI4Ji3FB7-R_MgonvJuzrwGZsDLg/p.png)" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "e9e030f0-6797-4736-b7b2-eb61e52f0585", + "cell_type": "markdown", + "id": "ca552437-3287-4ca4-8f3a-8cef709c0932", "metadata": {}, - "outputs": [], "source": [ - "class PhotomSettings(BaseModel):\n", - " camera: Camera | None = None\n", - " observatory: Observatory | None = None\n", - " apertures: PhotometryApertures | None = None" + "## Individual setting groups\n", + "\n", + "Please try filling out the individual groups of settings below. Note anything you find confusing, unusual, or incorrect.\n", + "\n", + "For each setting group, once the settings are \"Valid\" please press the green \"Save\" icon for that group. That will generate one file per tab, so 7 files total. Please email those along with your experience with the interface." ] }, { "cell_type": "code", "execution_count": null, - "id": "04a620ee-1a60-4298-ab5b-c0477d1b4717", + "id": "3d26814b-775e-4f72-b535-ebce1b23e5d6", "metadata": {}, "outputs": [], "source": [ - "pm = PhotomSettings()" + "tabs = ipw.Tab()\n", + "tabs.children = uis\n", + "tabs.titles = [c.__name__ for c in classes]\n", + "tabs" ] }, { - "cell_type": "code", - "execution_count": null, - "id": "25017075-3ce3-4eee-b3b8-3e7df3e698a4", + "cell_type": "markdown", + "id": "6124aab2-449a-40b0-8284-f3b96e2d77de", "metadata": {}, - "outputs": [], "source": [ - "AutoUi(PhotomSettings)" + "## Combined settings\n", + "\n", + "This is the same set of information you enetered above but now presented as a single interface. Please fill this version out and note anything you find confusing, unusual, or incorrect.\n", + "\n", + "When you have finished the settings please click the green \"Save\" icon and and email the file." ] }, { "cell_type": "code", "execution_count": null, - "id": "0b6a550b-3cb6-46c7-acdd-b8eef7d280bf", + "id": "89472b65-69f5-439f-b34c-e26e3133e84c", "metadata": { "scrolled": true }, "outputs": [], "source": [ - "class DictaFoo(BaseModel):\n", - " dicta: dict" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e3c30f66-0514-4b02-af5f-8f802a0ed8d7", - "metadata": {}, - "outputs": [], - "source": [ - "AutoUi(DictaFoo)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "afa62dc9-f6d6-4d12-a2e8-fb689a6d6df1", - "metadata": {}, - "outputs": [], - "source": [ - "from stellarphot.settings.models import _PassbandMapEntry\n", - "\" \".join(_PassbandMapEntry.__doc__.split('\\n\\n')[0].replace('\\n', ' ').split())" + "all_photom = AutoUi(PhotometrySettings)\n", + "all_photom.path = Path(\"combined_photometry_settings.json\")\n", + "all_photom.show_validation = False\n", + "all_photom" ] }, { "cell_type": "code", "execution_count": null, - "id": "83b25581-c0a1-44e7-8d8f-20d7d756836d", - "metadata": {}, - "outputs": [], - "source": [ - "from typing import Annotated\n", - "from pydantic import BaseModel, Field\n", - "\n", - "from ipyautoui import AutoUi\n", - "\n", - "class NestedStr(BaseModel):\n", - " \"\"\"A nested model\"\"\"\n", - " string: str\n", - "\n", - "class NestedFloat(BaseModel):\n", - " \"\"\"Nested float\"\"\"\n", - " number: float | None\n", - "\n", - "class Compound(BaseModel):\n", - " \"\"\"My compound model\"\"\"\n", - " nest_str_1: Annotated[\n", - " NestedStr,\n", - " Field(description=\"Overridden description nest_str_1\")\n", - " ]\n", - " nest_str_2: NestedStr = Field(description=\"Non-annotated overridden description nest_str_2\")\n", - " nest_str_3: NestedStr = Field(title=\"NestedStr\", description=\"Overridden, and title doesn't work nest_str_3\")\n", - " nest_str_4: NestedStr = Field(title=\"Nested Str\", description=\"Overridden, this title works nest_str_4\")\n", - " nest_float: NestedFloat\n", - "\n", - "AutoUi(Compound)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "53599a47-ee36-466a-807f-8f8e5c1c7a7d", + "id": "51403657-ca4e-4615-bc59-65b93e3fad6d", "metadata": {}, "outputs": [], - "source": [ - "AutoUi(Compound)" - ] + "source": [] }, { "cell_type": "code",