diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..95fdba3 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,97 @@ +name: Docker publish + +on: + workflow_dispatch: + push: + branches: + - next + - qa + - main + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + +jobs: + build: + + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + channels: conda-forge,defaults + mamba-version: "*" + environment-file: environment.yml + cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }} + cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }} + - name: Install requirements + run: | + # --quiet should turn off progress bars to make logs more readable + conda env create + + - name: Create tag version + id: tag + run: | + conda activate livedata + echo "tag=$(versioningit)" >> $GITHUB_OUTPUT + + - name: Create latest tag version + id: latest_tag + run: | + case ${{ github.ref }} in + + refs/heads/next) + echo "latest_tag=latest-dev" >> $GITHUB_OUTPUT + ;; + + refs/heads/qa) + echo "latest_tag=latest-test" >> $GITHUB_OUTPUT + ;; + + refs/heads/main) + echo "latest_tag=latest-prod" >> $GITHUB_OUTPUT + ;; + + *) + exit 1 + ;; + + esac + + - name: Check tag names + run: | + echo ${{ steps.latest_tag.outputs.latest_tag }} + echo ${{ steps.tag.outputs.tag }} + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push docker image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + tags: ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.latest_tag.outputs.latest_tag }} + push: true + + - name: Push version tag only for main branch + if: github.ref == 'refs/heads/main' + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + tags: ${{ env.REGISTRY }}/${{ github.repository }}/live_data_server:${{ steps.tag.outputs.tag }} + push: true diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 99edace..d47a15f 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: push: - branches: main + branches: [next, qa, main] tags: ['v*'] jobs: @@ -22,9 +22,10 @@ jobs: LIVE_PLOT_SECRET_KEY: "1234_live_data_server" DJANGO_SUPERUSER_USERNAME: livedatauser DJANGO_SUPERUSER_PASSWORD: livedatapass + COVERAGE_RUN: coverage run -m steps: - - uses: actions/checkout@v3 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 with: auto-update-conda: true channels: conda-forge,defaults @@ -35,8 +36,28 @@ jobs: - name: Start docker containers run: | cp ./config/docker-compose.envlocal.yml docker-compose.yml - docker compose up --build -d + docker-compose up --build -d - name: Sleep, wait for containers to start up run: sleep 30 - name: Run unit tests run: python -m pytest tests/ + - name: Stop the coverage process + # Stopping the coverage process allows the code coverage to be written to disk + run: docker exec live_data_server_livedata_1 /bin/bash -c "pkill coverage" + - name: Copy code coverage out of docker container + run: docker cp live_data_server_livedata_1:/var/www/livedata/app /tmp/ + - name: Combine and show code coverage + shell: bash -l {0} + run: | + cd /tmp/app + coverage combine + coverage xml + cp coverage.xml $OLDPWD + coverage report + - name: Bring down docker containers completely now + # This will completely remove the containers + run: docker-compose down + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d0ca584 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-added-large-files + args: [--maxkb=8192] + - id: check-merge-conflict + - id: check-yaml + args: [--allow-multiple-documents] + exclude: "conda.recipe/meta.yaml" + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.9 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format diff --git a/Dockerfile b/Dockerfile index 506440f..5a46c28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /var/www/livedata COPY docker-entrypoint.sh /usr/bin/ -COPY live_data_server app +COPY src/live_data_server app RUN mkdir ./static RUN chmod +x /usr/bin/docker-entrypoint.sh diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..520e395 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +BSD 3-Clause License + +Copyright (c) 2024, OAK RIDGE NATIONAL LABORATORY + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 79a642e..87a3913 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Developer documentation at https://livedata-ornl.readthedocs.io/en/latest/ ## Contributing -Create a conda environment `livedata`, containing all the dependencies +Create a conda environment `livedata`, containing all the dependencies ```python conda env create -f environment.yml conda activate livedata @@ -66,4 +66,4 @@ run the following command from within directory `docs/`: make html ``` The documentation will be built in the `docs/_build/html` directory. To view the documentation, -open the `docs/_build/html/index.html` file in a web browser. \ No newline at end of file +open the `docs/_build/html/index.html` file in a web browser. diff --git a/config/docker-compose.envlocal.yml b/config/docker-compose.envlocal.yml index 049cb54..7e3d395 100644 --- a/config/docker-compose.envlocal.yml +++ b/config/docker-compose.envlocal.yml @@ -27,6 +27,7 @@ services: DATABASE_HOST: ${DATABASE_HOST} DATABASE_PORT: ${DATABASE_PORT} LIVE_PLOT_SECRET_KEY: ${LIVE_PLOT_SECRET_KEY} + COVERAGE_RUN: ${COVERAGE_RUN} command: /usr/bin/docker-entrypoint.sh volumes: - web-static:/var/www/livedata/static @@ -61,4 +62,4 @@ services: volumes: web-static: - db-data: \ No newline at end of file + db-data: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2125ca7..b56730a 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -24,4 +24,4 @@ python manage.py createcachetable webcache python manage.py ensure_adminuser --username=${DJANGO_SUPERUSER_USERNAME} --email='workflow@example.com' --password=${DJANGO_SUPERUSER_PASSWORD} # run application -gunicorn live_data_server.wsgi:application -w 2 -b :8000 --reload +${COVERAGE_RUN} gunicorn live_data_server.wsgi:application -w 2 -b :8000 --reload diff --git a/docs/conf.py b/docs/conf.py index a1d77d2..6de6959 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = "LIVE DATA SERVER" -copyright = "2023, SAE@ORNL" +copyright = "2023, SAE@ORNL" # noqa A001 author = "SAE@ORNL" # The version info for the project you're documenting, acts as replacement for diff --git a/docs/developer/config_for_local_use.rst b/docs/developer/config_for_local_use.rst index 45f7df0..bf9a9bd 100644 --- a/docs/developer/config_for_local_use.rst +++ b/docs/developer/config_for_local_use.rst @@ -41,7 +41,7 @@ Changing it to a wildcard lets us ping it as local host and not get a 400 error. You should now be able to interact with the api on `localhost:9999` but there's a little more. -You need to add a user that you can use for your post requests, +You need to add a user that you can use for your post requests, .. code-block:: bash @@ -53,7 +53,7 @@ You need to add a user that you can use for your post requests, I personally recommend using `Postman `_ when interacting with the api. If you do, set the request body to `form-data`! -Some relevant form-data field keys: +Some relevant form-data field keys: #. file #. username diff --git a/docs/developer/service_through_apache.rst b/docs/developer/service_through_apache.rst index b791d8d..36f2ead 100644 --- a/docs/developer/service_through_apache.rst +++ b/docs/developer/service_through_apache.rst @@ -13,6 +13,3 @@ Apache HTTP Server. The `Apache configuration file `_ is located at ``/etc/httpd/conf.d/apache_django_wsgi.conf``, and the application is located in ``/var/www/livedata/app``. - - - diff --git a/docs/index.rst b/docs/index.rst index d287581..6949620 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,4 +13,4 @@ Indices and tables * :ref:`genindex` * :ref:`search` -.. uncomment this once we include the API in the docs * :ref:`modindex` \ No newline at end of file +.. uncomment this once we include the API in the docs * :ref:`modindex` diff --git a/environment.yml b/environment.yml index 18e9f1a..45b39e3 100644 --- a/environment.yml +++ b/environment.yml @@ -2,13 +2,19 @@ name: livedata channels: - conda-forge dependencies: - - python=3.6 + - python=3.7 - pip - postgresql=9.5.3 - sphinx - sphinx_rtd_theme - - django=2.0 + - django=2.1 - django-cors-headers - psycopg2 - gunicorn - pytest + - build + - versioningit + - toml + - requests<2.31 # can remove this condition once we allow newer versions of openssl + - pre-commit + - coverage diff --git a/live_data_server/live_data_server/__init__.py b/live_data_server/live_data_server/__init__.py deleted file mode 100644 index 5becc17..0000000 --- a/live_data_server/live_data_server/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "1.0.0" diff --git a/live_data_server/plots/migrations/0001_initial.py b/live_data_server/plots/migrations/0001_initial.py deleted file mode 100644 index 9f0717a..0000000 --- a/live_data_server/plots/migrations/0001_initial.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.5 on 2016-05-31 20:53 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='DataRun', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('run_number', models.IntegerField()), - ('run_id', models.TextField()), - ('created_on', models.DateTimeField(auto_now_add=True, verbose_name='Timestamp')), - ], - ), - migrations.CreateModel( - name='Instrument', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=128, unique=True)), - ('run_id_type', models.IntegerField(default=0)), - ], - ), - migrations.CreateModel( - name='PlotData', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('data_type', models.IntegerField()), - ('data', models.TextField()), - ('timestamp', models.DateTimeField(verbose_name='Timestamp')), - ('data_run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plots.DataRun')), - ], - ), - migrations.AddField( - model_name='datarun', - name='instrument', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='plots.Instrument'), - ), - ] diff --git a/live_data_server/plots/tests.py b/live_data_server/plots/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/live_data_server/plots/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/live_data_server/plots/urls.py b/live_data_server/plots/urls.py deleted file mode 100644 index 8ce2ece..0000000 --- a/live_data_server/plots/urls.py +++ /dev/null @@ -1,18 +0,0 @@ -#pylint: disable=invalid-name, line-too-long -""" - Define url structure -""" -from django.urls import re_path - -from . import views - -app_name = 'plots' - -urlpatterns = [ - re_path(r'^(?P[\w]+)/(?P\d+)/$', views.live_plot, name='live_plot'), - re_path(r'^(?P[\w]+)/(?P\d+)/update/json/$', views.update_as_json, name='update_as_json'), - re_path(r'^(?P[\w]+)/(?P\d+)/update/html/$', views.update_as_html, name='update_as_html'), - re_path(r'^(?P[\w]+)/(?P\d+)/upload_plot_data/$', views.upload_plot_data, name='upload_plot_data'), - re_path(r'^(?P[\w]+)/upload_user_data/$', views.upload_user_data, name='upload_user_data'), - re_path(r'^(?P[\w]+)/list/$', views.get_data_list, name='get_data_list'), -] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a53bfa1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,56 @@ +[project] +name = "live_data_server" +description = "Data server for data plots" +dynamic = ["version"] +requires-python = ">=3.6" +dependencies = [ + # list all runtime dependencies here +] +license = { text = "BSD-3" } + +[project.urls] +homepage = "https://livedata-ornl.readthedocs.io" # if no homepage, use repo url + +[build-system] +requires = [ + "setuptools >= 40.6.0", + "wheel", + "toml", + "versioningit" +] +build-backend = "setuptools.build_meta" + +[tool.black] +line-length = 119 + +[tool.versioningit.vcs] +method = "git" +default-tag = "0.0.1" + +[tool.versioningit.next-version] +method = "minor" + +[tool.versioningit.format] +distance = "{next_version}.dev{distance}" +dirty = "{version}+d{build_date:%Y%m%d}" +distance-dirty = "{next_version}.dev{distance}+d{build_date:%Y%m%d%H%M}" + +[tool.versioningit.write] +file = "src/live_data_server/live_data_server/_version.py" + +[tool.setuptools.packages.find] +where = ["src"] +exclude = ["tests*", "scripts*", "docs*"] + +[tool.pytest.ini_options] +pythonpath = [ + ".", "src", "scripts" +] +testpaths = ["tests"] +python_files = ["test*.py"] + +[tool.ruff] +line-length = 120 +select = ["A", "ARG","ASYNC","BLE","C90", "E", "F", "I", "N", "UP032", "W"] + +# Add additional 3rd party tool configuration here as needed diff --git a/scripts/docker-compose_validate.sh b/scripts/docker-compose_validate.sh index f77b8dd..dad9413 100755 --- a/scripts/docker-compose_validate.sh +++ b/scripts/docker-compose_validate.sh @@ -21,4 +21,4 @@ version_validate $version ${MINIMUM_VERSION_NUMBER} valid=$? test $valid -eq 1 && echo "Error: Invalid docker-compose. Minimum valid version is ${MINIMUM_VERSION_NUMBER}" -exit $valid \ No newline at end of file +exit $valid diff --git a/src/live_data_server/.coveragerc b/src/live_data_server/.coveragerc new file mode 100644 index 0000000..c900f8e --- /dev/null +++ b/src/live_data_server/.coveragerc @@ -0,0 +1,4 @@ +[run] +source=live_data_server,plots +parallel=True +relative_files=True diff --git a/src/live_data_server/live_data_server/__init__.py b/src/live_data_server/live_data_server/__init__.py new file mode 100644 index 0000000..58ec8d7 --- /dev/null +++ b/src/live_data_server/live_data_server/__init__.py @@ -0,0 +1,4 @@ +try: + from ._version import __version__ +except ImportError: + __version__ = "0.0.1" diff --git a/live_data_server/live_data_server/settings.py b/src/live_data_server/live_data_server/settings.py similarity index 51% rename from live_data_server/live_data_server/settings.py rename to src/live_data_server/live_data_server/settings.py index b51a028..4402ac4 100644 --- a/live_data_server/live_data_server/settings.py +++ b/src/live_data_server/live_data_server/settings.py @@ -20,62 +20,68 @@ # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'bq!jvls*4&^r^_za38ki!@rd7p3d83(f@@@&9q!)j0=5wln3&e' +SECRET_KEY = "bq!jvls*4&^r^_za38ki!@rd7p3d83(f@@@&9q!)j0=5wln3&e" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = bool(os.environ.get("APP_DEBUG", False)) -#CSRF_COOKIE_SECURE = True -#SESSION_COOKIE_SECURE = True -CSRF_TRUSTED_ORIGINS = ['.ornl.gov', '.sns.gov', 'localhost', '127.0.0.1'] - -ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'testfixture02-test.ornl.gov', 'livedata.sns.gov', 'scse-livedata-prod1.sns.gov'] +# CSRF_COOKIE_SECURE = True +# SESSION_COOKIE_SECURE = True +CSRF_TRUSTED_ORIGINS = [".ornl.gov", ".sns.gov", "localhost", "127.0.0.1"] + +ALLOWED_HOSTS = [ + "localhost", + "127.0.0.1", + "testfixture02-test.ornl.gov", + "livedata.sns.gov", + "scse-livedata-prod1.sns.gov", +] # Application definition INSTALLED_APPS = [ - 'plots.apps.PlotsConfig', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'corsheaders', + "plots.apps.PlotsConfig", + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "corsheaders", ] MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'corsheaders.middleware.CorsMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', + "django.middleware.security.SecurityMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "corsheaders.middleware.CorsMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = 'live_data_server.urls' +ROOT_URLCONF = "live_data_server.urls" CORS_ORIGIN_ALLOW_ALL = True TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [os.path.join(BASE_DIR, "templates")], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], }, }, ] -WSGI_APPLICATION = 'live_data_server.wsgi.application' +WSGI_APPLICATION = "live_data_server.wsgi.application" # Database @@ -93,12 +99,12 @@ "PORT": os.environ.get("DATABASE_PORT"), } } -DATABASES['default']['CONN_MAX_AGE']=5 +DATABASES["default"]["CONN_MAX_AGE"] = 5 CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', - 'LOCATION': 'webcache', + "default": { + "BACKEND": "django.core.cache.backends.db.DatabaseCache", + "LOCATION": "webcache", } } @@ -107,16 +113,16 @@ AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, ] @@ -124,9 +130,9 @@ # Internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = "en-us" -TIME_ZONE = 'America/New_York' +TIME_ZONE = "America/New_York" USE_I18N = True @@ -138,8 +144,8 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ -STATIC_URL = '/static/' -STATIC_ROOT = '/var/www/livedata/static/' +STATIC_URL = "/static/" +STATIC_ROOT = "/var/www/livedata/static/" # Add secret key to settings only if there's a non-empty environment variable with same name if "LIVE_PLOT_SECRET_KEY" in os.environ: @@ -149,8 +155,7 @@ # Import local settings if available try: - from local_settings import * -except ImportError as e: + from local_settings import * # noqa: F403 +except ImportError: LOCAL_SETTINGS = False pass - diff --git a/live_data_server/live_data_server/urls.py b/src/live_data_server/live_data_server/urls.py similarity index 76% rename from live_data_server/live_data_server/urls.py rename to src/live_data_server/live_data_server/urls.py index aaaad49..8f6c461 100644 --- a/live_data_server/live_data_server/urls.py +++ b/src/live_data_server/live_data_server/urls.py @@ -13,14 +13,15 @@ 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: path(r'^blog/', include('blog.urls')) """ -from django.urls import re_path, include + from django.contrib import admin +from django.urls import include, re_path from django.views.generic.base import RedirectView -app_name = 'live_data_server' +app_name = "live_data_server" urlpatterns = [ - re_path(r'^admin/', admin.site.urls), - re_path(r'^$', RedirectView.as_view(url='/plots/')), - re_path(r'^plots/', include('plots.urls', namespace="plots")), + re_path(r"^admin/", admin.site.urls), + re_path(r"^$", RedirectView.as_view(url="/plots/")), + re_path(r"^plots/", include("plots.urls", namespace="plots")), ] diff --git a/live_data_server/live_data_server/wsgi.py b/src/live_data_server/live_data_server/wsgi.py similarity index 100% rename from live_data_server/live_data_server/wsgi.py rename to src/live_data_server/live_data_server/wsgi.py diff --git a/live_data_server/manage.py b/src/live_data_server/manage.py similarity index 100% rename from live_data_server/manage.py rename to src/live_data_server/manage.py diff --git a/live_data_server/plots/__init__.py b/src/live_data_server/plots/__init__.py similarity index 100% rename from live_data_server/plots/__init__.py rename to src/live_data_server/plots/__init__.py diff --git a/live_data_server/plots/admin.py b/src/live_data_server/plots/admin.py similarity index 51% rename from live_data_server/plots/admin.py rename to src/live_data_server/plots/admin.py index 430df35..a1e54b9 100644 --- a/live_data_server/plots/admin.py +++ b/src/live_data_server/plots/admin.py @@ -1,13 +1,17 @@ from django.contrib import admin + from plots.models import DataRun, Instrument, PlotData + class PlotDataAdmin(admin.ModelAdmin): - readonly_fields=('data_run',) - list_display = ('id', 'data_run', 'data_type', 'timestamp') + readonly_fields = ("data_run",) + list_display = ("id", "data_run", "data_type", "timestamp") + class DataRunAdmin(admin.ModelAdmin): - list_display = ('id', 'run_number', 'run_id', 'instrument', 'created_on') + list_display = ("id", "run_number", "run_id", "instrument", "created_on") + admin.site.register(DataRun, DataRunAdmin) admin.site.register(Instrument) -admin.site.register(PlotData, PlotDataAdmin) \ No newline at end of file +admin.site.register(PlotData, PlotDataAdmin) diff --git a/live_data_server/plots/apps.py b/src/live_data_server/plots/apps.py similarity index 52% rename from live_data_server/plots/apps.py rename to src/live_data_server/plots/apps.py index 26e2f60..10d83c7 100644 --- a/live_data_server/plots/apps.py +++ b/src/live_data_server/plots/apps.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class PlotsConfig(AppConfig): - name = 'plots' + name = "plots" diff --git a/live_data_server/plots/management/__init__.py b/src/live_data_server/plots/management/__init__.py similarity index 100% rename from live_data_server/plots/management/__init__.py rename to src/live_data_server/plots/management/__init__.py diff --git a/live_data_server/plots/management/commands/__init__.py b/src/live_data_server/plots/management/commands/__init__.py similarity index 100% rename from live_data_server/plots/management/commands/__init__.py rename to src/live_data_server/plots/management/commands/__init__.py diff --git a/live_data_server/plots/management/commands/ensure_adminuser.py b/src/live_data_server/plots/management/commands/ensure_adminuser.py similarity index 78% rename from live_data_server/plots/management/commands/ensure_adminuser.py rename to src/live_data_server/plots/management/commands/ensure_adminuser.py index 0a015df..94e0667 100644 --- a/live_data_server/plots/management/commands/ensure_adminuser.py +++ b/src/live_data_server/plots/management/commands/ensure_adminuser.py @@ -12,10 +12,10 @@ def add_arguments(self, parser): parser.add_argument("--email", help="Admin's email") parser.add_argument("--password", help="Admin's password") - def handle(self, *args, **options): - User = get_user_model() - if not User.objects.filter(username=options["username"]).exists(): - User.objects.create_superuser( + def handle(self, *args, **options): # noqa: ARG002 + user = get_user_model() + if not user.objects.filter(username=options["username"]).exists(): + user.objects.create_superuser( username=options["username"], email=options["email"], password=options["password"], diff --git a/src/live_data_server/plots/migrations/0001_initial.py b/src/live_data_server/plots/migrations/0001_initial.py new file mode 100644 index 0000000..2a55632 --- /dev/null +++ b/src/live_data_server/plots/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-05-31 20:53 +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="DataRun", + fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("run_number", models.IntegerField()), + ("run_id", models.TextField()), + ("created_on", models.DateTimeField(auto_now_add=True, verbose_name="Timestamp")), + ], + ), + migrations.CreateModel( + name="Instrument", + fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=128, unique=True)), + ("run_id_type", models.IntegerField(default=0)), + ], + ), + migrations.CreateModel( + name="PlotData", + fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("data_type", models.IntegerField()), + ("data", models.TextField()), + ("timestamp", models.DateTimeField(verbose_name="Timestamp")), + ("data_run", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="plots.DataRun")), + ], + ), + migrations.AddField( + model_name="datarun", + name="instrument", + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="plots.Instrument"), + ), + ] diff --git a/live_data_server/plots/migrations/__init__.py b/src/live_data_server/plots/migrations/__init__.py similarity index 100% rename from live_data_server/plots/migrations/__init__.py rename to src/live_data_server/plots/migrations/__init__.py diff --git a/live_data_server/plots/models.py b/src/live_data_server/plots/models.py similarity index 56% rename from live_data_server/plots/models.py rename to src/live_data_server/plots/models.py index 2bcff36..81f5e43 100644 --- a/live_data_server/plots/models.py +++ b/src/live_data_server/plots/models.py @@ -1,20 +1,21 @@ """ - Plot data models +Plot data models """ -from __future__ import unicode_literals -import sys + import logging +import sys + from django.db import models +DATA_TYPES = {"json": 0, "html": 1, "div": 1} +DATA_TYPE_INFO = {0: {"name": "json"}, 1: {"name": "html"}} -DATA_TYPES = {'json': 0, 'html': 1, 'div': 1} -DATA_TYPE_INFO = {0: {'name': 'json'}, - 1: {'name': 'html'}} class Instrument(models.Model): """ - Table of instruments + Table of instruments """ + name = models.CharField(max_length=128, unique=True) run_id_type = models.IntegerField(default=0) @@ -24,14 +25,15 @@ def __unicode__(self): class DataRun(models.Model): """ - Table of runs + Table of runs """ + run_number = models.IntegerField() # Optional free-form run identifier run_id = models.TextField() instrument = models.ForeignKey(Instrument, on_delete=models.deletion.CASCADE) - created_on = models.DateTimeField('Timestamp', auto_now_add=True) + created_on = models.DateTimeField("Timestamp", auto_now_add=True) def __unicode__(self): return "%s_%d_%s" % (self.instrument, self.run_number, self.run_id) @@ -39,8 +41,9 @@ def __unicode__(self): class PlotData(models.Model): """ - Table of plot data. This data can either be json or html + Table of plot data. This data can either be json or html """ + ## DataRun this run status belongs to data_run = models.ForeignKey(DataRun, on_delete=models.deletion.CASCADE) ## Data type: @@ -51,25 +54,25 @@ class PlotData(models.Model): ## JSON/HTML data data = models.TextField() - timestamp = models.DateTimeField('Timestamp') + timestamp = models.DateTimeField("Timestamp") def __unicode__(self): return "%s" % self.data_run def is_div(self): """ - Return whether the data is a
+ Return whether the data is a
""" - return self.data_type%100 == 1 + return self.data_type % 100 == 1 def is_data_type_valid(self, data_type): """ - Verify that a given data type matches the stored data - @param data_type: data type to check + Verify that a given data type matches the stored data + @param data_type: data type to check """ try: data_type = int(data_type) - return self.data_type == data_type%100 or data_type == -1 + return self.data_type == data_type % 100 or data_type == -1 except ValueError: logging.error("Could not verify data type: %s", sys.exc_value) return False @@ -77,32 +80,32 @@ def is_data_type_valid(self, data_type): @classmethod def get_data_type_from_data(cls, data): """ - Inspect the data to guess what type it is. - @param data: block of text to store + Inspect the data to guess what type it is. + @param data: block of text to store """ - if data.startswith('[\w]+)/(?P\d+)/$", views.live_plot, name="live_plot"), + re_path(r"^(?P[\w]+)/(?P\d+)/update/json/$", views.update_as_json, name="update_as_json"), + re_path(r"^(?P[\w]+)/(?P\d+)/update/html/$", views.update_as_html, name="update_as_html"), + re_path( + r"^(?P[\w]+)/(?P\d+)/upload_plot_data/$", views.upload_plot_data, name="upload_plot_data" + ), + re_path(r"^(?P[\w]+)/upload_user_data/$", views.upload_user_data, name="upload_user_data"), + re_path(r"^(?P[\w]+)/list/$", views.get_data_list, name="get_data_list"), +] diff --git a/live_data_server/plots/view_util.py b/src/live_data_server/plots/view_util.py similarity index 78% rename from live_data_server/plots/view_util.py rename to src/live_data_server/plots/view_util.py index a927b62..3771255 100644 --- a/live_data_server/plots/view_util.py +++ b/src/live_data_server/plots/view_util.py @@ -1,21 +1,24 @@ -#pylint: disable=invalid-name, bare-except +# pylint: disable=invalid-name, bare-except """ - Utility functions to support views. +Utility functions to support views. """ -import sys + +import hashlib import logging -from django.utils import timezone -from django.http import HttpResponse +import sys + from django.conf import settings -from plots.models import Instrument, DataRun, PlotData -import hashlib +from django.http import HttpResponse +from django.utils import timezone + +from plots.models import DataRun, Instrument, PlotData def generate_key(instrument, run_id): """ - Generate a secret key for a run on a given instrument - @param instrument: instrument name - @param run_id: run number + Generate a secret key for a run on a given instrument + @param instrument: instrument name + @param run_id: run number """ if not hasattr(settings, "LIVE_PLOT_SECRET_KEY"): return None @@ -30,35 +33,37 @@ def generate_key(instrument, run_id): def check_key(fn): """ - Function decorator to check whether a user is allowed - to see a view. + Function decorator to check whether a user is allowed + to see a view. - Usually used for AJAX calls. + Usually used for AJAX calls. """ + def request_processor(request, instrument, run_id): """ - Decorator function + Decorator function """ try: - client_key = request.GET.get('key', None) + client_key = request.GET.get("key", None) server_key = generate_key(instrument, run_id) # Temporary bypass during testing # Remove client_key is None condition when we deploy if client_key is None or server_key is None or client_key == server_key: return fn(request, instrument, run_id) return HttpResponse(status=401) - except: + except: # noqa: E722 logging.error("[%s]: %s" % (request.path, sys.exc_info()[1])) return HttpResponse(status=500) + return request_processor def get_or_create_run(instrument, run_id, create=True): """ - Retrieve a run entry, or create it. - @param instrument: instrument name - @param run_id: run number - @param create: if True, missing entries will be created + Retrieve a run entry, or create it. + @param instrument: instrument name + @param run_id: run number + @param create: if True, missing entries will be created """ # Get or create the instrument @@ -86,11 +91,12 @@ def get_or_create_run(instrument, run_id, create=True): return run_obj + def get_plot_data(instrument, run_id, data_type=None): """ - Get plot data for requested instrument and run number - @param instrument: instrument name - @param run_id: run number + Get plot data for requested instrument and run number + @param instrument: instrument name + @param run_id: run number """ run_obj = get_or_create_run(instrument, run_id, create=False) plot_data_list = PlotData.objects.filter(data_run=run_obj) @@ -105,8 +111,8 @@ def get_plot_data(instrument, run_id, data_type=None): def store_user_data(user, data_id, data, data_type): """ - Store plot data and associate it to a user identifier (a name, not - an actual user since users don't log in to this system). + Store plot data and associate it to a user identifier (a name, not + an actual user since users don't log in to this system). """ # Get or create the instrument instrument_list = Instrument.objects.filter(name=user.lower()) @@ -119,7 +125,7 @@ def store_user_data(user, data_id, data, data_type): run_list = DataRun.objects.filter(instrument=instrument_obj, run_id=data_id) if len(run_list) > 0: - run_obj = run_list.latest('created_on') + run_obj = run_list.latest("created_on") else: run_obj = DataRun() run_obj.instrument = instrument_obj @@ -149,11 +155,11 @@ def store_user_data(user, data_id, data, data_type): def store_plot_data(instrument, run_id, data, data_type): """ - Store plot data - @param instrument: instrument name - @param run_id: run number - @param data: data to be stored - @param data_type: requested data type + Store plot data + @param instrument: instrument name + @param run_id: run number + @param data: data to be stored + @param data_type: requested data type """ run_object = get_or_create_run(instrument, run_id) diff --git a/live_data_server/plots/views.py b/src/live_data_server/plots/views.py similarity index 57% rename from live_data_server/plots/views.py rename to src/live_data_server/plots/views.py index 5d0e340..9ccfdcc 100644 --- a/live_data_server/plots/views.py +++ b/src/live_data_server/plots/views.py @@ -1,25 +1,29 @@ -#pylint: disable=unused-argument, invalid-name +# pylint: disable=unused-argument, invalid-name """ - Definition of views +Definition of views """ -import logging + import json -from django.shortcuts import render_to_response, get_object_or_404 -from django.http import HttpResponseNotFound, JsonResponse, HttpResponse -from django.views.decorators.csrf import csrf_exempt -from django.urls import reverse +import logging + +from django.conf import settings +from django.contrib.auth import authenticate, login from django.core.exceptions import PermissionDenied -from django.views.decorators.cache import cache_page -from django.contrib.auth import login, authenticate +from django.http import HttpResponse, HttpResponseNotFound, JsonResponse +from django.shortcuts import get_object_or_404, render_to_response +from django.urls import reverse from django.utils import dateformat, timezone -from django.conf import settings +from django.views.decorators.cache import cache_page +from django.views.decorators.csrf import csrf_exempt + +from plots.models import DataRun, Instrument, PlotData -from plots.models import PlotData, Instrument, DataRun from . import view_util + def _check_credentials(request): """ - Internal utility method to check whether a user has access to a view + Internal utility method to check whether a user has access to a view """ # If we don't allow guests but the user is authenticated, return the function if request.user.is_authenticated: @@ -28,15 +32,16 @@ def _check_credentials(request): def check_credentials(fn): """ - Function decorator to authenticate a request + Function decorator to authenticate a request """ + def request_processor(request, *args, **kws): """ - Authentication process + Authentication process """ if request.user.is_authenticated: return fn(request, *args, **kws) - if request.method == 'POST': + if request.method == "POST": username = request.POST.get("username") password = request.POST.get("password") request_user = authenticate(username=username, password=password) @@ -45,36 +50,40 @@ def request_processor(request, *args, **kws): return fn(request, *args, **kws) else: raise PermissionDenied + return request_processor + def live_plot(request, instrument, run_id): """ - Test view for live plotting. - @param instrument: instrument name - @param run_id: run number + Test view for live plotting. + @param instrument: instrument name + @param run_id: run number """ - data_type_default = PlotData.get_data_type_from_string('html') - data_type = request.GET.get('data_type', default=data_type_default) - update_url = reverse('plots:update_as_%s' % PlotData.data_type_as_string(data_type), - kwargs={'instrument': instrument, 'run_id': run_id}) + data_type_default = PlotData.get_data_type_from_string("html") + data_type = request.GET.get("data_type", default=data_type_default) + update_url = reverse( + "plots:update_as_%s" % PlotData.data_type_as_string(data_type), + kwargs={"instrument": instrument, "run_id": run_id}, + ) client_key = view_util.generate_key(instrument, run_id) if client_key is not None: update_url += "?key=%s" % client_key template_values = {} - template_values['data_type'] = data_type - template_values['update_url'] = update_url - return render_to_response('plots/live_plot.html', - template_values) + template_values["data_type"] = data_type + template_values["update_url"] = update_url + return render_to_response("plots/live_plot.html", template_values) + @view_util.check_key @cache_page(15) -def update_as_json(request, instrument, run_id): +def update_as_json(request, instrument, run_id): # noqa: ARG001 """ - Ajax call to get JSON data - @param instrument: instrument name - @param run_id: run number + Ajax call to get JSON data + @param instrument: instrument name + @param run_id: run number """ - data_type = PlotData.get_data_type_from_string('json') + data_type = PlotData.get_data_type_from_string("json") plot_data = view_util.get_plot_data(instrument, run_id, data_type=data_type) if plot_data is None: @@ -85,15 +94,16 @@ def update_as_json(request, instrument, run_id): json_data = json.loads(plot_data.data) return JsonResponse(json_data, safe=False) + @view_util.check_key @cache_page(15) -def update_as_html(request, instrument, run_id): +def update_as_html(request, instrument, run_id): # noqa: ARG001 """ - Ajax call to get plot data as an html
- @param instrument: instrument name - @param run_id: run number + Ajax call to get plot data as an html
+ @param instrument: instrument name + @param run_id: run number """ - data_type = PlotData.get_data_type_from_string('html') + data_type = PlotData.get_data_type_from_string("html") plot_data = view_util.get_plot_data(instrument, run_id, data_type=data_type) if plot_data is None: @@ -102,23 +112,24 @@ def update_as_html(request, instrument, run_id): return HttpResponseNotFound(error_msg) response = HttpResponse(str(plot_data.data), content_type="text/html") - response['Content-Length'] = len(response.content) + response["Content-Length"] = len(response.content) return response + @check_credentials def _store(request, instrument, run_id=None, as_user=False): """ - Store plot data - @param instrument: instrument name or user name - @param run_id: run number - @param as_user: if True, we will store as user data + Store plot data + @param instrument: instrument name or user name + @param run_id: run number + @param as_user: if True, we will store as user data """ - if request.user.is_authenticated and 'file' in request.FILES: - raw_data = request.FILES['file'].read().decode('utf-8') + if request.user.is_authenticated and "file" in request.FILES: + raw_data = request.FILES["file"].read().decode("utf-8") data_type_default = PlotData.get_data_type_from_data(raw_data) - data_type = request.POST.get('data_type', default=data_type_default) + data_type = request.POST.get("data_type", default=data_type_default) if as_user: - data_id = request.POST.get('data_id', default='') + data_id = request.POST.get("data_id", default="") view_util.store_user_data(instrument, data_id, raw_data, data_type) else: view_util.store_plot_data(instrument, run_id, raw_data, data_type) @@ -127,28 +138,31 @@ def _store(request, instrument, run_id=None, as_user=False): return HttpResponse() + @csrf_exempt def upload_plot_data(request, instrument, run_id): """ - Upload plot data - @param instrument: instrument name - @param run_id: run number + Upload plot data + @param instrument: instrument name + @param run_id: run number """ return _store(request, instrument, run_id, as_user=False) + @csrf_exempt def upload_user_data(request, user): """ - Upload plot data - @param user: user identifier to use + Upload plot data + @param user: user identifier to use """ return _store(request, user, as_user=True) + @csrf_exempt @check_credentials def get_data_list(request, instrument): """ - Get a list of user data + Get a list of user data """ if request.user.is_authenticated: instrument_object = get_object_or_404(Instrument, name=instrument.lower()) @@ -156,11 +170,15 @@ def get_data_list(request, instrument): for item in DataRun.objects.filter(instrument=instrument_object): localtime = timezone.localtime(item.created_on) df = dateformat.DateFormat(localtime) - data_list.append(dict(id=item.id, - run_number=str(item.run_number), - run_id=item.run_id, - timestamp=item.created_on.isoformat(), - created_on=df.format(settings.DATETIME_FORMAT))) + data_list.append( + dict( + id=item.id, + run_number=str(item.run_number), + run_id=item.run_id, + timestamp=item.created_on.isoformat(), + created_on=df.format(settings.DATETIME_FORMAT), + ) + ) response = HttpResponse(json.dumps(data_list), content_type="application/json") return response else: diff --git a/live_data_server/templates/base.html b/src/live_data_server/templates/base.html similarity index 99% rename from live_data_server/templates/base.html rename to src/live_data_server/templates/base.html index ac1f4c3..6936315 100644 --- a/live_data_server/templates/base.html +++ b/src/live_data_server/templates/base.html @@ -23,4 +23,4 @@ {% endblock %} - \ No newline at end of file + diff --git a/live_data_server/templates/plots/live_plot.html b/src/live_data_server/templates/plots/live_plot.html similarity index 100% rename from live_data_server/templates/plots/live_plot.html rename to src/live_data_server/templates/plots/live_plot.html diff --git a/test_client/test_client.py b/test_client/test_client.py index c74058d..d006bdd 100644 --- a/test_client/test_client.py +++ b/test_client/test_client.py @@ -1,50 +1,54 @@ -#pylint: disable=invalid-name +# pylint: disable=invalid-name """ - Test client that uploads data +Test client that uploads data """ -from __future__ import print_function -import sys + +import argparse +import datetime +import json import string +import sys + +import numpy as np +import plotly.graph_objs as go import requests -import datetime from plotly.offline import plot -import plotly.graph_objs as go -import numpy as np -import json -import argparse -sys.path.insert(0, '../live_data_server') +sys.path.insert(0, "../live_data_server") JSON_DATA = False -API_USER = 'admin' -API_PWD = 'adminadmin' +API_USER = "admin" +API_PWD = "adminadmin" INSTRUMENT = "REF_L" RUN_NUMBER = 123456 UPLOAD_URL = "http://127.0.0.1:8888/plots/$instrument/$run_number/upload_plot_data/" USER_UPLOAD_URL = "http://127.0.0.1:8888/plots/$user/upload_user_data/" + def test_sine_wave(run_number, instrument): """ - Produce test sine wave plot + Produce test sine wave plot """ now = datetime.datetime.now() x = np.arange(1, now.second) y = np.sin(x) x2 = np.arange(1, now.second) - y2 = np.sin(x+1.0) - err = 0.2*np.ones(len(x)) - sys.path.append('/opt/postprocessing/postprocessing') + y2 = np.sin(x + 1.0) + err = 0.2 * np.ones(len(x)) + sys.path.append("/opt/postprocessing/postprocessing") from publish_plot import plot1d - data = [[x, y, err, 2*err], [x2, y2, err, 2*err]] - data_names = ['data', 'offset'] - return plot1d(run_number, data_list=data, instrument=instrument, - x_title='theta', y_title='sin(theta)', - data_names=data_names) + + data = [[x, y, err, 2 * err], [x2, y2, err, 2 * err]] + data_names = ["data", "offset"] + return plot1d( + run_number, data_list=data, instrument=instrument, x_title="theta", y_title="sin(theta)", data_names=data_names + ) + def get_plot_as_json(): """ - Generates normal distributed 2D points - Number of points depends on the real time seconds. + Generates normal distributed 2D points + Number of points depends on the real time seconds. """ now = datetime.datetime.now() n_points = 100 * now.second @@ -52,14 +56,14 @@ def get_plot_as_json(): cov = [[1, 0], [0, 1]] x, y = np.random.multivariate_normal(mean, cov, n_points).T data = dict( - x=x.tolist(), y=y.tolist(), mode='markers', name='points', - marker=dict(color='rgb(0,0,0)', size=4, opacity=0.4) + x=x.tolist(), y=y.tolist(), mode="markers", name="points", marker=dict(color="rgb(0,0,0)", size=4, opacity=0.4) ) return data + def get_plot_as_div(): """ - Return a plot as a div + Return a plot as a div """ trace = go.Scatter(get_plot_as_json()) data = [trace] @@ -69,56 +73,55 @@ def get_plot_as_div(): autosize=False, width=800, height=700, - xaxis=dict(range=[-4, 4],), - yaxis=dict(range=[-4, 4],), + xaxis=dict( + range=[-4, 4], + ), + yaxis=dict( + range=[-4, 4], + ), margin=dict(t=50), - hovermode='closest', + hovermode="closest", bargap=0, ) fig = go.Figure(data=data, layout=layout) - plot_div = plot(fig, output_type='div', include_plotlyjs=False) + plot_div = plot(fig, output_type="div", include_plotlyjs=False) return plot_div + if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Test plot data producer') - parser.add_argument('--json', help='Produce json data', - action='store_true', dest='as_json') - parser.add_argument('--html', help='Produce html data', - action='store_false', dest='as_json') - parser.add_argument('-r', metavar='runid', type=int, help='Run number (int)', - dest='runid', required=True) - parser.add_argument('-d', metavar='description', help='Data description', - dest='description', required=False) - parser.add_argument('-i', metavar='instrument', help='Instrument', - dest='instrument', required=True) - parser.add_argument('-c', metavar='config', help='Config file', - dest='config_file', required=False) + parser = argparse.ArgumentParser(description="Test plot data producer") + parser.add_argument("--json", help="Produce json data", action="store_true", dest="as_json") + parser.add_argument("--html", help="Produce html data", action="store_false", dest="as_json") + parser.add_argument("-r", metavar="runid", type=int, help="Run number (int)", dest="runid", required=True) + parser.add_argument("-d", metavar="description", help="Data description", dest="description", required=False) + parser.add_argument("-i", metavar="instrument", help="Instrument", dest="instrument", required=True) + parser.add_argument("-c", metavar="config", help="Config file", dest="config_file", required=False) namespace = parser.parse_args() as_json_data = JSON_DATA if namespace.as_json is None else namespace.as_json - monitor_user = {'username': API_USER, 'password': API_PWD} + monitor_user = {"username": API_USER, "password": API_PWD} url_template = string.Template(UPLOAD_URL) url = url_template.substitute(instrument=namespace.instrument, run_number=namespace.runid) if as_json_data: print("Producing json data") - files = {'file': json.dumps(get_plot_as_json())} + files = {"file": json.dumps(get_plot_as_json())} else: print("Producing html data") - files = {'file': get_plot_as_div()} + files = {"file": get_plot_as_div()} if namespace.config_file is not None: - sys.path.append('/opt/postprocessing/postprocessing') + sys.path.append("/opt/postprocessing/postprocessing") from publish_plot import publish_plot - request = publish_plot(namespace.instrument, namespace.runid, - files=files, config_file=namespace.config_file) + + request = publish_plot(namespace.instrument, namespace.runid, files=files, config_file=namespace.config_file) else: - #request = test_sine_wave(namespace.runid, namespace.instrument) + # request = test_sine_wave(namespace.runid, namespace.instrument) if namespace.description is not None: url_template = string.Template(USER_UPLOAD_URL) url = url_template.substitute(user=namespace.instrument) - monitor_user['data_id'] = namespace.description + monitor_user["data_id"] = namespace.description request = requests.post(url, data=monitor_user, files=files, verify=False) print(request.status_code) diff --git a/tests/conftest.py b/tests/conftest.py index 669aba5..a1044ad 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,15 +1,14 @@ # 3rd-party imports -import pytest - # standard imports import os import sys +import pytest this_module_path = sys.modules[__name__].__file__ -@pytest.fixture(scope='module') +@pytest.fixture(scope="module") def data_server(): r"""Object containing info and functionality for data files. @@ -18,8 +17,7 @@ def data_server(): """ class _DataServe(object): - - _directory = os.path.join(os.path.dirname(this_module_path), 'data') + _directory = os.path.join(os.path.dirname(this_module_path), "data") @property def directory(self): @@ -30,7 +28,7 @@ def path_to(self, basename): r"""Absolute path to a data file""" file_path = os.path.join(self._directory, basename) if not os.path.isfile(file_path): - raise IOError('File {basename} not found in data directory {self._directory}') + raise IOError("File {basename} not found in data directory {self._directory}") return file_path return _DataServe() diff --git a/tests/data/reflectivity.html b/tests/data/reflectivity.html index 7eadfbb..3dca966 100644 --- a/tests/data/reflectivity.html +++ b/tests/data/reflectivity.html @@ -1 +1 @@ -
\ No newline at end of file +
diff --git a/tests/data/reflectivity.json b/tests/data/reflectivity.json index 6052669..d0773b9 100644 --- a/tests/data/reflectivity.json +++ b/tests/data/reflectivity.json @@ -1 +1 @@ -{"data": {"q": [0.008172, 0.00821286, 0.00825393, 0.0082952, 0.00833667, 0.00837835, 0.00842025, 0.00846235, 0.00850466, 0.00854718, 0.00858992, 0.00863287, 0.00867603, 0.00871941, 0.00876301, 0.00880682, 0.00885086, 0.00889511, 0.00893959, 0.00898429, 0.00902921, 0.00907435, 0.00911973, 0.00916532, 0.00921115, 0.00925721, 0.00930349, 0.00935001, 0.00939676, 0.00944374, 0.00949096, 0.00953842, 0.00958611, 0.00963404, 0.00968221, 0.00973062, 0.00977928, 0.00982817, 0.00987731, 0.0099267, 0.00997633, 0.0100262, 0.0100763, 0.0101267, 0.0101774, 0.0102282, 0.0102794, 0.0103308, 0.0103824, 0.0104344, 0.0104865, 0.010539, 0.0105917, 0.0106446, 0.0106978, 0.0107513, 0.0108051, 0.0108591, 0.0109134, 0.010968, 0.0110228, 0.0110779, 0.0111333, 0.011189, 0.0112449, 0.0113011, 0.0113577, 0.0114144, 0.0114715, 0.0115289, 0.0115865, 0.0116444, 0.0117027, 0.0117612, 0.01182, 0.0118791, 0.0119385, 0.0119982, 0.0120582, 0.0121185, 0.012179, 0.0122399, 0.0123011, 0.0123626, 0.0124245, 0.0124866, 0.012549, 0.0126118, 0.0126748, 0.0127382, 0.0128019, 0.0128659, 0.0129302, 0.0129949, 0.0130599, 0.0131252, 0.0131908, 0.0132567, 0.013323, 0.0133896, 0.0134566, 0.0135239, 0.0135915, 0.0136594, 0.0137277, 0.0137964, 0.0138654, 0.0139347, 0.0140044, 0.0140744, 0.0141447, 0.0142155, 0.0142865, 0.014358, 0.0144298, 0.0145019, 0.0145744, 0.0146473, 0.0147205, 0.0147941, 0.0148681, 0.0149425, 0.0150172, 0.0150923, 0.0151677, 0.0152436, 0.0153198, 0.0153964, 0.0154733, 0.0155507, 0.0156285, 0.0157066, 0.0157851, 0.0158641, 0.0159434, 0.0160231, 0.0161032, 0.0161837, 0.0162647, 0.016346, 0.0164277, 0.0165099, 0.0165924, 0.0166754, 0.0167587, 0.0168425, 0.0169267, 0.0170114, 0.0170964, 0.0171819, 0.0172678, 0.0173542, 0.0174409, 0.0175281, 0.0176158, 0.0177039, 0.0177924, 0.0178813, 0.0179707, 0.0180606, 0.0181509, 0.0182417, 0.0183329, 0.0184245, 0.0185167, 0.0186092, 0.0187023, 0.0187958, 0.0188898, 0.0189842, 0.0190791, 0.0191745, 0.0192704, 0.0193668, 0.0194636, 0.0195609, 0.0196587, 0.019757, 0.0198558, 0.0199551, 0.0200549, 0.0201551, 0.0202559, 0.0203572, 0.020459, 0.0205613, 0.0206641, 0.0207674, 0.0208712, 0.0209756, 0.0210805, 0.0211859, 0.0212918, 0.0213983, 0.0215052, 0.0216128, 0.0217208, 0.0218294, 0.0219386, 0.0220483, 0.0221585, 0.0222693, 0.0223807, 0.0224926, 0.022605, 0.0227181, 0.0228316, 0.0229458, 0.0230605, 0.0231758, 0.0232917, 0.0234082, 0.0235252, 0.0236428, 0.0237611, 0.0238799, 0.0239993, 0.0241193, 0.0242398, 0.024361, 0.0244829, 0.0246053, 0.0247283, 0.0248519, 0.0249762, 0.0251011, 0.0252266, 0.0253527, 0.0254795, 0.0256069, 0.0257349, 0.0258636, 0.0259929, 0.0261229, 0.0262535, 0.0263847, 0.0265167, 0.0266493, 0.0267825, 0.0269164, 0.027051, 0.0271863, 0.0273222, 0.0274588, 0.0275961, 0.0277341, 0.0278727, 0.0280121, 0.0281522, 0.0282929, 0.0284344, 0.0285766, 0.0287194, 0.028863, 0.0290074, 0.0291524, 0.0292982, 0.0294446, 0.0295919, 0.0297398, 0.0298885, 0.030038, 0.0301882, 0.0303391, 0.0304908, 0.0306432, 0.0307965, 0.0309504, 0.0311052, 0.0312607, 0.031417, 0.0315741, 0.031732, 0.0318906, 0.0320501, 0.0322103, 0.0323714, 0.0325333, 0.0326959, 0.0328594, 0.0330237, 0.0331888, 0.0333548, 0.0335215, 0.0336891, 0.0338576, 0.0340269, 0.034197, 0.034368, 0.0345398, 0.0347125, 0.0348861, 0.0350605, 0.0352358, 0.035412, 0.0355891, 0.035767, 0.0359459, 0.0361256, 0.0363062, 0.0364877, 0.0366702, 0.0368535, 0.0370378, 0.037223, 0.0374091, 0.0375961, 0.0377841, 0.037973, 0.0381629, 0.0383537, 0.0385455, 0.0387382, 0.0389319, 0.0391266, 0.0393222, 0.0395188, 0.0397164, 0.039915, 0.0401146, 0.0403151, 0.0405167, 0.0407193, 0.0409229, 0.0411275, 0.0413332, 0.0415398, 0.0417475, 0.0419563, 0.042166, 0.0423769, 0.0425887, 0.0428017, 0.0430157, 0.0432308, 0.0434469, 0.0436642, 0.0438825, 0.0441019, 0.0443224, 0.044544, 0.0447667, 0.0449906, 0.0452155, 0.0454416, 0.0456688, 0.0458972, 0.0461266, 0.0463573, 0.0465891, 0.046822, 0.0470561, 0.0472914, 0.0475279, 0.0477655, 0.0480043, 0.0482443, 0.0484856, 0.048728, 0.0489716, 0.0492165, 0.0494626, 0.0497099, 0.0499584, 0.0502082, 0.0504593, 0.0507116, 0.0509651, 0.05122, 0.0514761, 0.0517334, 0.0519921, 0.0522521, 0.0525133, 0.0527759, 0.0530398, 0.053305, 0.0535715, 0.0538393, 0.0541085, 0.0543791, 0.054651, 0.0549242, 0.0551989, 0.0554749, 0.0557522, 0.056031, 0.0563111, 0.0565927, 0.0568757, 0.0574458, 0.0580217, 0.0583118, 0.0586034, 0.0588964, 0.0591909, 0.0594869, 0.0597843, 0.0600832, 0.0603836, 0.0606855, 0.060989, 0.0612939, 0.0616004, 0.0619084, 0.0622179, 0.062529, 0.0628417, 0.0631559, 0.0634717, 0.063789, 0.064108, 0.0644285, 0.0647506, 0.0650744, 0.0653998, 0.0657268, 0.0660554, 0.0663857, 0.0667176, 0.0670512, 0.0673864, 0.0677234, 0.068062, 0.0684023, 0.0687443, 0.069088, 0.0694335, 0.0697806, 0.0701296, 0.0704802, 0.0708326, 0.0711868, 0.0715427, 0.0719004, 0.0722599, 0.0726212, 0.0729843, 0.0733492, 0.073716, 0.0740846, 0.074455, 0.0748273, 0.0752014, 0.0755774, 0.0759553, 0.0763351, 0.0767167, 0.0771003, 0.0774858, 0.0778733, 0.0782626, 0.0786539, 0.0790472, 0.0794424, 0.0798397, 0.0802389, 0.08064, 0.0810432, 0.0814485, 0.0818557, 0.082265, 0.0826763, 0.0830897, 0.0835051, 0.0839227, 0.0843423, 0.084764, 0.0851878, 0.0856138, 0.0860418, 0.086472, 0.0869044, 0.0873389, 0.0877756, 0.0882145, 0.0886556, 0.0890988, 0.0895443, 0.089992, 0.090442, 0.0908942, 0.0913487, 0.0918054, 0.0922645, 0.0927258, 0.0931894, 0.0936554, 0.0941236, 0.0945943, 0.0950672, 0.0955426, 0.0960203, 0.0965004, 0.0969829, 0.0974678, 0.0979551, 0.0984449, 0.0989371, 0.0994318, 0.099929, 0.100429, 0.100931, 0.101435, 0.101943, 0.102452, 0.102965, 0.103479, 0.103997, 0.104517, 0.105039, 0.105565, 0.106092, 0.106623, 0.107156, 0.107692, 0.10823, 0.108771, 0.109315, 0.109862, 0.110411, 0.110963, 0.111518, 0.112076, 0.112636, 0.114334, 0.114906, 0.11548, 0.116058, 0.116638, 0.117221, 0.117807, 0.118396, 0.118988, 0.119583, 0.120181, 0.120782, 0.121386, 0.121993, 0.122603, 0.123216, 0.123832, 0.124451, 0.125073, 0.125699, 0.126327, 0.126959, 0.127593, 0.128231, 0.128873, 0.129517, 0.130165, 0.130815, 0.131469, 0.132127, 0.132787, 0.133451, 0.134119, 0.134789, 0.135463, 0.13614, 0.136821, 0.137505, 0.138193, 0.138884, 0.139578, 0.140276, 0.140977, 0.141682, 0.142391, 0.143103, 0.143818, 0.144537, 0.14526, 0.145986, 0.146716, 0.14745, 0.148187, 0.148928, 0.149673, 0.150421, 0.151173, 0.151929, 0.152689, 0.153452, 0.154219, 0.15499, 0.155765, 0.156544, 0.157327, 0.158114, 0.158904, 0.159699, 0.160497, 0.1613, 0.162106, 0.162917, 0.163731, 0.16455, 0.165373, 0.1662, 0.167031, 0.167866, 0.168705, 0.169549, 0.170396, 0.171248, 0.172104, 0.172965, 0.17383, 0.174699, 0.175572, 0.17645, 0.177333, 0.178219, 0.17911, 0.180006, 0.180906, 0.18181, 0.18272, 0.183633, 0.184551, 0.185474, 0.186401, 0.187333, 0.18827, 0.189211, 0.190157, 0.191108, 0.192064, 0.193024, 0.193989, 0.194959, 0.195934, 0.196914, 0.197898, 0.198888, 0.199882, 0.200882, 0.201886, 0.202895, 0.20391, 0.204929, 0.205954, 0.206984, 0.208019, 0.209059, 0.210104, 0.211155, 0.21221, 0.213272, 0.214338, 0.21541, 0.216487, 0.217569, 0.218657, 0.21975, 0.220849, 0.221953, 0.223063, 0.226426, 0.227558, 0.228696, 0.229839, 0.230988], "r": [1.00292, 0.971192, 1.15077, 0.986956, 1.11587, 0.868071, 1.03662, 0.975888, 0.921519, 0.963813, 1.13785, 0.879322, 0.904291, 0.960079, 1.05178, 0.937505, 0.852204, 0.92745, 0.949921, 0.941086, 0.990593, 1.06334, 0.850118, 1.02997, 0.981144, 1.06409, 1.0525, 1.01219, 1.17437, 1.02095, 0.972304, 1.00347, 0.980313, 1.0392, 0.885747, 1.1032, 0.928186, 0.974964, 1.11438, 0.989245, 1.0883, 1.06736, 1.03328, 1.11365, 0.867132, 1.11961, 0.982688, 1.10156, 0.993693, 1.09618, 1.10815, 1.13116, 1.02664, 1.19802, 0.971994, 0.855004, 1.06508, 0.710988, 1.16638, 0.795614, 1.04319, 0.978022, 1.16085, 1.08049, 0.925478, 0.890683, 0.926998, 1.23492, 0.92285, 1.03241, 1.02922, 1.13379, 0.91124, 1.1672, 1.11862, 0.977663, 1.00321, 1.27346, 0.942306, 0.975787, 1.00096, 1.04272, 0.901378, 1.07828, 1.40169, 1.18658, 1.06869, 0.60747, 1.09955, 1.30338, 1.27393, 0.712323, 1.08667, 1.26968, 0.99335, 0.793935, 0.805301, 0.704552, 0.998537, 1.37669, 0.745817, 0.997689, 1.01386, 0.848817, 0.987279, 1.1512, 1.03067, 1.16615, 0.819864, 0.854037, 1.23485, 0.98543, 1.12174, 1.12348, 1.04177, 1.13156, 1.01784, 1.22415, 1.18742, 0.978064, 1.04994, 1.195, 1.0653, 1.18844, 0.884946, 0.919997, 0.766168, 1.02155, 1.09101, 0.927982, 1.07516, 1.0108, 1.12633, 0.925146, 0.835491, 0.905745, 0.911295, 0.981521, 0.886403, 1.00407, 1.00255, 0.983482, 1.12563, 0.95987, 1.00391, 1.01212, 0.941355, 1.06561, 0.947267, 1.26844, 1.0539, 1.01119, 1.01191, 0.915213, 1.25082, 1.20032, 1.00709, 1.19384, 1.11701, 0.924855, 1.42254, 1.07455, 1.08506, 1.14755, 1.0508, 1.22673, 1.10784, 1.01769, 1.19105, 1.18333, 1.00153, 1.05151, 0.947062, 1.02145, 1.16664, 0.887597, 1.1837, 0.858938, 0.9389, 1.1025, 0.824691, 0.837882, 0.957074, 0.979177, 1.01209, 0.964635, 0.927921, 0.829201, 0.908633, 1.01934, 0.877527, 0.783077, 0.856552, 0.765909, 0.858218, 0.692793, 0.789756, 0.691225, 0.7381, 0.792627, 0.675245, 0.678238, 0.588589, 0.4956, 0.624768, 0.540253, 0.487914, 0.388434, 0.29552, 0.262364, 0.245016, 0.244247, 0.22012, 0.208477, 0.0984338, 0.0834702, 0.134408, 0.0460322, 0.104583, 0.0701407, 0.0968901, 0.0784045, 0.080036, 0.0933233, 0.0933611, 0.0996699, 0.14349, 0.143021, 0.154417, 0.199931, 0.180384, 0.201729, 0.176713, 0.169209, 0.176325, 0.177329, 0.173372, 0.172186, 0.19886, 0.1693, 0.161824, 0.153135, 0.143997, 0.135123, 0.148046, 0.133631, 0.123411, 0.120676, 0.101916, 0.09243, 0.0788419, 0.0670949, 0.0651125, 0.0410867, 0.0416023, 0.0309742, 0.028229, 0.0204895, 0.0202423, 0.0165425, 0.0114432, 0.0136166, 0.0110706, 0.0145096, 0.0110999, 0.0124228, 0.00825276, 0.0147912, 0.0236032, 0.0200068, 0.0269945, 0.0271531, 0.0297328, 0.028804, 0.0330796, 0.0344553, 0.0390683, 0.0421349, 0.0434423, 0.0440841, 0.042578, 0.0524933, 0.0433906, 0.0466075, 0.0529198, 0.0519203, 0.041759, 0.0466991, 0.0465623, 0.0351167, 0.0390897, 0.0349293, 0.0348531, 0.0332029, 0.0283975, 0.0297603, 0.0252154, 0.0237409, 0.0169114, 0.0151352, 0.0159799, 0.0144532, 0.00994997, 0.010066, 0.00795546, 0.00622054, 0.00536303, 0.00553554, 0.00572172, 0.00293029, 0.00317657, 0.00320922, 0.00202862, 0.00428848, 0.00479759, 0.00505415, 0.0055886, 0.00716625, 0.0059857, 0.00796053, 0.0101988, 0.00917143, 0.00902145, 0.0122506, 0.0125174, 0.0137219, 0.0120376, 0.0141255, 0.0143386, 0.0113002, 0.0128401, 0.00992566, 0.0109588, 0.0107454, 0.0110805, 0.00884727, 0.0120634, 0.00752058, 0.00842594, 0.00774131, 0.00761727, 0.00552107, 0.0044357, 0.00468039, 0.00387187, 0.00474897, 0.00406616, 0.00283662, 0.0030261, 0.00215181, 0.00182975, 0.00214599, 0.00186849, 0.0013744, 0.00131575, 0.00105039, 0.00079614, 0.00124936, 0.002032, 0.00246464, 0.00341765, 0.00218628, 0.00268209, 0.00226943, 0.00156694, 0.00488737, 0.00468206, 0.00319607, 0.00213851, 0.00390668, 0.00377475, 0.00404314, 0.00373381, 0.00314767, 0.00310604, 0.00264213, 0.00286319, 0.00242841, 0.00287563, 0.00167811, 0.00186347, 0.00150979, 0.00115834, 0.000956193, 0.00135321, 0.000975256, 0.00117656, 0.000698104, 0.000985391, 0.000602807, 0.000878607, 0.00109072, 0.000897622, 0.00123703, 0.000890803, 0.00106575, 0.00117098, 0.00124319, 0.00113229, 0.00125115, 0.00139065, 0.00147215, 0.00123702, 0.00110392, 0.00121703, 0.00121689, 0.000994781, 0.000960309, 0.000905197, 0.000877697, 0.000791067, 0.000650816, 0.000626826, 0.000545251, 0.00063976, 0.000495526, 0.000564592, 0.000480068, 0.000514332, 0.000422844, 0.000480304, 0.000541866, 0.00047141, 0.000523089, 0.000377551, 0.000496435, 0.000497835, 0.000420738, 0.000522678, 0.000483264, 0.000482833, 0.000457207, 0.000408057, 0.000482037, 0.000417429, 0.000455811, 0.000354858, 0.000402967, 0.000317876, 0.000320527, 0.000339683, 0.000400798, 0.000366692, 0.000354629, 0.000335668, 0.000331915, 0.000364803, 0.000249298, 0.000300569, 0.000240954, 0.000285774, 0.000278591, 0.000334738, 0.000269736, 0.000274244, 0.000180688, 0.000202035, 0.000135781, 0.000157465, 0.000155504, 0.000131167, 0.000102872, 0.000149093, 0.000197615, 0.000142599, 0.000166956, 0.000203958, 0.000220751, 0.000192277, 0.000245779, 0.000260747, 0.000262128, 0.000268821, 0.000204924, 0.000179931, 0.000179807, 0.000132241, 0.00014404, 0.000112582, 8.24807e-05, 0.000102099, 9.64085e-05, 8.96959e-05, 8.00637e-05, 0.000113314, 0.000101373, 6.93316e-05, 0.000110289, 9.43429e-05, 0.000112602, 0.000154759, 0.000153559, 0.00012149, 0.000163509, 0.000156451, 0.0001304, 0.000119213, 0.000124597, 0.000107769, 8.78461e-05, 6.72209e-05, 4.62037e-05, 6.59568e-05, 4.9187e-05, 3.96607e-05, 3.70079e-05, 4.65372e-05, 5.67716e-05, 9.05437e-05, 9.1959e-05, 0.000122418, 0.000110385, 0.000122651, 9.15517e-05, 0.000112266, 0.000105764, 0.000107731, 0.000106559, 9.14283e-05, 8.68672e-05, 6.79247e-05, 4.86921e-05, 4.31307e-05, 5.22529e-05, 3.91618e-05, 6.19553e-05, 6.59506e-05, 8.20919e-05, 8.81841e-05, 8.23669e-05, 8.85319e-05, 9.62182e-05, 9.3108e-05, 7.70811e-05, 6.6108e-05, 5.96323e-05, 4.91469e-05, 3.7699e-05, 4.40864e-05, 3.85976e-05, 3.24852e-05, 4.28189e-05, 4.92379e-05, 5.63694e-05, 6.41489e-05, 6.36953e-05, 7.58073e-05, 7.71302e-05, 7.14003e-05, 6.77262e-05, 5.35281e-05, 4.97905e-05, 4.12638e-05, 3.7584e-05, 3.74145e-05, 2.63684e-05, 2.77975e-05, 3.47507e-05, 4.18307e-05, 4.0189e-05, 4.7285e-05, 5.20295e-05, 5.42083e-05, 4.79752e-05, 4.10873e-05, 4.33201e-05, 3.86206e-05, 3.19011e-05, 3.15057e-05, 2.60612e-05, 2.49649e-05, 3.19175e-05, 2.85573e-05, 2.7201e-05, 2.89327e-05, 3.16217e-05, 3.12817e-05, 3.18768e-05, 2.76412e-05, 2.96478e-05, 2.93279e-05, 2.44444e-05, 1.94642e-05, 1.98767e-05, 1.97081e-05, 1.84137e-05, 1.89752e-05, 2.07281e-05, 2.01638e-05, 2.0518e-05, 1.96767e-05, 2.57499e-05, 1.89441e-05, 2.01576e-05, 1.85662e-05, 1.71257e-05, 1.29336e-05, 1.02941e-05, 1.41655e-05, 1.36468e-05, 1.58523e-05, 1.82486e-05, 1.75587e-05, 1.48144e-05, 1.55886e-05, 1.21944e-05, 1.00156e-05, 1.25917e-05, 1.19513e-05, 9.98581e-06, 1.07556e-05, 9.96089e-06, 7.95805e-06, 1.20891e-05, 1.1881e-05, 1.15014e-05, 1.19971e-05, 1.18283e-05, 1.00102e-05, 8.51288e-06, 8.33002e-06, 7.78799e-06, 7.14395e-06, 5.82789e-06, 9.72182e-06, 5.61111e-06, 8.55194e-06, 7.63515e-06, 6.11208e-06, 4.21374e-06, 7.30086e-06, 6.68711e-06, 4.2231e-06, 4.21437e-06, 4.35891e-06, 6.41207e-06, 7.63863e-06, 8.02082e-06, 3.77972e-06, 4.43254e-06, 5.48094e-06, 3.83391e-06, 5.05487e-06, 4.94465e-06, 2.744e-06, 6.91534e-06, 2.30264e-06, 5.36865e-06, 5.22637e-06, 3.92417e-06, 2.38112e-06, 5.09107e-06, 2.13432e-06, 3.93496e-06, 3.49014e-06, 3.19194e-06, 5.07744e-06, 4.36514e-06, 3.66655e-06, 4.55321e-06, 4.99929e-06, 4.00323e-06, 2.82518e-06, 2.337e-06, 2.59131e-06], "dr": [0.143562, 0.140376, 0.147066, 0.138312, 0.142276, 0.122621, 0.127989, 0.12624, 0.12117, 0.120155, 0.126179, 0.112469, 0.112921, 0.11231, 0.120441, 0.108001, 0.0982821, 0.104966, 0.108515, 0.105099, 0.0999317, 0.10458, 0.092527, 0.0973013, 0.0972482, 0.0987262, 0.0987666, 0.0938169, 0.0994313, 0.0916201, 0.0868019, 0.0866643, 0.0957968, 0.0982065, 0.0873898, 0.0983046, 0.085203, 0.0915249, 0.0968745, 0.0871783, 0.0871533, 0.08759, 0.0852251, 0.14785, 0.13641, 0.147406, 0.137544, 0.146827, 0.131711, 0.141212, 0.133986, 0.13224, 0.129488, 0.134809, 0.120069, 0.112042, 0.120814, 0.102072, 0.123693, 0.103156, 0.116507, 0.113055, 0.116867, 0.110605, 0.102493, 0.0993741, 0.0989763, 0.111928, 0.0951901, 0.0993264, 0.0980305, 0.104541, 0.0913366, 0.100727, 0.0974528, 0.0887229, 0.0924962, 0.103203, 0.112647, 0.116004, 0.116644, 0.116737, 0.104493, 0.113236, 0.238028, 0.217167, 0.203294, 0.150905, 0.196926, 0.206602, 0.213538, 0.161333, 0.178545, 0.202617, 0.171002, 0.149034, 0.150027, 0.139696, 0.160584, 0.189886, 0.144956, 0.158926, 0.160051, 0.141616, 0.151485, 0.160063, 0.152794, 0.160349, 0.131391, 0.13011, 0.158911, 0.140684, 0.144743, 0.141347, 0.134607, 0.141344, 0.135563, 0.141847, 0.138486, 0.124839, 0.127528, 0.135457, 0.127396, 0.131934, 0.112746, 0.1135, 0.0992348, 0.116975, 0.120495, 0.112075, 0.114944, 0.109077, 0.117531, 0.103928, 0.0974142, 0.100584, 0.101199, 0.100478, 0.095415, 0.103634, 0.103181, 0.0989955, 0.110613, 0.0966819, 0.102029, 0.0927409, 0.0873035, 0.0921, 0.153706, 0.180301, 0.161001, 0.15587, 0.159163, 0.143922, 0.168698, 0.166109, 0.146189, 0.152325, 0.151295, 0.132461, 0.165372, 0.139582, 0.134088, 0.145057, 0.139506, 0.143635, 0.136155, 0.136137, 0.137298, 0.141408, 0.124292, 0.129101, 0.120507, 0.121347, 0.134562, 0.110736, 0.132831, 0.102215, 0.108443, 0.122989, 0.102279, 0.101896, 0.112026, 0.109216, 0.110382, 0.106194, 0.101551, 0.0946836, 0.0996562, 0.107036, 0.0955732, 0.0855743, 0.0924012, 0.0846843, 0.0912598, 0.0785231, 0.0863238, 0.0799711, 0.0788651, 0.0833762, 0.0748302, 0.073964, 0.0713272, 0.060868, 0.0722167, 0.0654142, 0.0597526, 0.0538244, 0.0458957, 0.0433313, 0.0424308, 0.041165, 0.0377424, 0.0379716, 0.026467, 0.0243191, 0.0299691, 0.0183809, 0.0261195, 0.0209121, 0.0250401, 0.0226787, 0.0223993, 0.0234883, 0.0243294, 0.0241258, 0.0285527, 0.0277281, 0.0290187, 0.0323748, 0.031328, 0.0314126, 0.0298074, 0.0288382, 0.0147337, 0.0151648, 0.0140528, 0.0150647, 0.016198, 0.0142444, 0.0137219, 0.0132102, 0.0123794, 0.0127943, 0.00930868, 0.00851283, 0.00803037, 0.00832334, 0.00743699, 0.00676687, 0.00603658, 0.00534526, 0.00529829, 0.00390879, 0.00386728, 0.00348629, 0.00313723, 0.00265151, 0.00273978, 0.00227824, 0.0019756, 0.00216484, 0.00188989, 0.00217689, 0.00181312, 0.00198781, 0.00166266, 0.00209323, 0.00280436, 0.00253923, 0.00278995, 0.00290266, 0.00308674, 0.00287231, 0.00305707, 0.00320022, 0.00367082, 0.00378367, 0.00372019, 0.00385004, 0.00371925, 0.00446067, 0.00384104, 0.00397702, 0.00422683, 0.00428922, 0.00355087, 0.00381995, 0.00385667, 0.00311907, 0.00338182, 0.00316863, 0.00321549, 0.00316987, 0.00285291, 0.002979, 0.00265692, 0.00250095, 0.00212677, 0.00216555, 0.00206639, 0.00210538, 0.00160574, 0.00164621, 0.00147275, 0.00133555, 0.0012465, 0.00133324, 0.00143205, 0.00103801, 0.00102652, 0.000988294, 0.000794098, 0.00114729, 0.00112385, 0.00119684, 0.00119956, 0.00139726, 0.00131576, 0.00145829, 0.00165739, 0.00151106, 0.00154041, 0.00177204, 0.00181606, 0.00186453, 0.001757, 0.00192164, 0.00198164, 0.00163329, 0.0017327, 0.00150664, 0.00162809, 0.00157129, 0.00165577, 0.00147589, 0.00166186, 0.00133863, 0.00142338, 0.00134015, 0.00133894, 0.0011047, 0.00100847, 0.00105066, 0.000968148, 0.00105379, 0.000979444, 0.00085018, 0.000861822, 0.000721294, 0.000703323, 0.000743716, 0.000708914, 0.00058874, 0.000627509, 0.000619435, 0.000593779, 0.000648653, 0.000708966, 0.000779759, 0.000880171, 0.000726099, 0.000802307, 0.000759438, 0.000678727, 0.00103408, 0.00102819, 0.000865933, 0.000729375, 0.000499752, 0.000497742, 0.000553276, 0.000499348, 0.000420713, 0.000440801, 0.000384981, 0.000422662, 0.000401228, 0.000475283, 0.000323406, 0.000359189, 0.000347648, 0.000302771, 0.000253405, 0.000347207, 0.000270138, 0.000304166, 0.000241279, 0.000290394, 0.000219497, 8.53536e-05, 0.0003005, 0.000256147, 0.000314661, 0.000258493, 0.00026753, 0.000283751, 0.000322823, 0.000289032, 0.000102861, 0.000108358, 0.000118719, 0.000101694, 9.14261e-05, 0.000101913, 0.000100895, 8.63978e-05, 8.33671e-05, 8.17164e-05, 8.36303e-05, 7.98841e-05, 6.86318e-05, 6.86178e-05, 6.37824e-05, 7.23849e-05, 6.09289e-05, 6.45962e-05, 5.90799e-05, 6.31051e-05, 5.34182e-05, 5.73674e-05, 6.26992e-05, 5.49863e-05, 5.91543e-05, 4.92624e-05, 5.81507e-05, 5.82673e-05, 5.26238e-05, 6.16637e-05, 5.74421e-05, 5.55663e-05, 5.42189e-05, 5.40547e-05, 5.6791e-05, 5.47041e-05, 5.41302e-05, 4.80854e-05, 5.14189e-05, 4.73259e-05, 4.66573e-05, 4.92597e-05, 5.57258e-05, 5.17542e-05, 5.0589e-05, 4.84001e-05, 4.5989e-05, 5.14605e-05, 4.03888e-05, 4.54e-05, 4.01531e-05, 4.37192e-05, 4.30003e-05, 4.75926e-05, 4.3329e-05, 4.07376e-05, 3.52851e-05, 3.64646e-05, 3.13879e-05, 3.197e-05, 3.10578e-05, 2.8936e-05, 2.83616e-05, 2.99239e-05, 3.34018e-05, 2.93044e-05, 3.16973e-05, 3.38978e-05, 3.65169e-05, 3.51668e-05, 3.81087e-05, 3.86178e-05, 3.92315e-05, 3.91585e-05, 3.43188e-05, 3.17251e-05, 3.14917e-05, 2.81333e-05, 3.05252e-05, 2.59642e-05, 2.31224e-05, 2.51174e-05, 2.44145e-05, 2.30323e-05, 2.30693e-05, 2.46871e-05, 2.39554e-05, 2.0182e-05, 2.6743e-05, 2.36204e-05, 2.68721e-05, 3.0511e-05, 2.90938e-05, 2.62705e-05, 2.96091e-05, 2.95805e-05, 2.7251e-05, 2.7127e-05, 2.9955e-05, 2.4836e-05, 2.3892e-05, 2.05541e-05, 1.75072e-05, 1.0601e-05, 9.71594e-06, 9.49875e-06, 8.02037e-06, 8.4931e-06, 9.62743e-06, 1.19503e-05, 1.15063e-05, 1.37728e-05, 1.3562e-05, 1.46742e-05, 1.10809e-05, 1.37049e-05, 1.28715e-05, 1.32564e-05, 1.33108e-05, 1.26311e-05, 1.17713e-05, 1.16885e-05, 8.97055e-06, 8.7201e-06, 9.89259e-06, 8.43873e-06, 9.37302e-06, 1.04384e-05, 1.21924e-05, 1.21754e-05, 1.05417e-05, 1.24076e-05, 1.3428e-05, 6.46081e-06, 5.56239e-06, 5.09811e-06, 4.92802e-06, 4.13651e-06, 3.49557e-06, 3.94797e-06, 3.5427e-06, 3.1171e-06, 3.66435e-06, 4.04758e-06, 4.69554e-06, 5.13148e-06, 4.82745e-06, 5.5527e-06, 5.74261e-06, 5.30999e-06, 5.15087e-06, 4.34138e-06, 4.23768e-06, 3.78639e-06, 3.54629e-06, 3.5381e-06, 2.91336e-06, 2.81536e-06, 3.16954e-06, 3.63066e-06, 3.55001e-06, 4.00946e-06, 4.17843e-06, 4.4655e-06, 4.07245e-06, 3.60727e-06, 3.76205e-06, 3.55129e-06, 3.16071e-06, 3.14556e-06, 2.75927e-06, 2.70107e-06, 3.15302e-06, 2.98716e-06, 2.95533e-06, 3.18675e-06, 3.47401e-06, 3.2581e-06, 3.38854e-06, 3.0222e-06, 3.05766e-06, 3.01e-06, 2.60505e-06, 2.43157e-06, 2.26844e-06, 2.48918e-06, 2.38755e-06, 2.42889e-06, 2.46858e-06, 2.37956e-06, 2.48621e-06, 2.43534e-06, 2.79845e-06, 2.36134e-06, 2.49151e-06, 2.30205e-06, 2.11306e-06, 1.9884e-06, 1.65242e-06, 1.96205e-06, 1.90605e-06, 2.0711e-06, 2.23865e-06, 2.13635e-06, 1.94884e-06, 2.04773e-06, 1.94767e-06, 1.75802e-06, 1.81618e-06, 1.71624e-06, 1.61162e-06, 1.66517e-06, 1.69622e-06, 1.53716e-06, 1.71996e-06, 1.75911e-06, 1.74292e-06, 1.7116e-06, 1.79622e-06, 1.51725e-06, 1.50141e-06, 1.49965e-06, 1.51918e-06, 1.43582e-06, 1.39389e-06, 1.61419e-06, 1.36693e-06, 1.5177e-06, 1.3817e-06, 1.28712e-06, 1.23896e-06, 1.53262e-06, 1.33132e-06, 1.16413e-06, 1.20268e-06, 1.30002e-06, 1.36266e-06, 1.52538e-06, 1.42844e-06, 1.26132e-06, 1.17553e-06, 1.20089e-06, 1.15134e-06, 1.23911e-06, 1.20598e-06, 1.18421e-06, 1.35398e-06, 1.16865e-06, 1.28973e-06, 1.38865e-06, 1.19477e-06, 1.10254e-06, 1.31804e-06, 9.93385e-07, 1.1268e-06, 1.07586e-06, 1.1222e-06, 1.24669e-06, 1.11755e-06, 1.14503e-06, 1.23252e-06, 1.30625e-06, 1.18134e-06, 9.91102e-07, 1.0445e-06, 1.09342e-06], "dq": [0.00108796, 0.0010889, 0.00108984, 0.00109079, 0.00109174, 0.0010927, 0.00109367, 0.00109463, 0.00109561, 0.00109659, 0.00109757, 0.00109856, 0.00109955, 0.00110055, 0.00110155, 0.00110256, 0.00110357, 0.00110459, 0.00110561, 0.00110664, 0.00110767, 0.00110871, 0.00110975, 0.0011108, 0.00111186, 0.00111292, 0.00111398, 0.00111505, 0.00111613, 0.00111721, 0.00111829, 0.00111938, 0.00112048, 0.00112158, 0.00112269, 0.0011238, 0.00112492, 0.00112605, 0.00112718, 0.00112831, 0.00112946, 0.0011306, 0.00113176, 0.00113291, 0.00113408, 0.00113525, 0.00113643, 0.00113761, 0.0011388, 0.00113999, 0.00114119, 0.0011424, 0.00114361, 0.00114483, 0.00114605, 0.00114728, 0.00114852, 0.00114976, 0.00115101, 0.00115226, 0.00115352, 0.00115479, 0.00115607, 0.00115735, 0.00115863, 0.00115993, 0.00116123, 0.00116253, 0.00116384, 0.00116516, 0.00116649, 0.00116782, 0.00116916, 0.00117051, 0.00117186, 0.00117322, 0.00117459, 0.00117596, 0.00117734, 0.00117872, 0.00118012, 0.00118152, 0.00118293, 0.00118434, 0.00118576, 0.00118719, 0.00118863, 0.00119007, 0.00119152, 0.00119298, 0.00119444, 0.00119592, 0.0011974, 0.00119888, 0.00120038, 0.00120188, 0.00120339, 0.0012049, 0.00120643, 0.00120796, 0.0012095, 0.00121105, 0.0012126, 0.00121417, 0.00121574, 0.00121732, 0.0012189, 0.0012205, 0.0012221, 0.00122371, 0.00122533, 0.00122696, 0.00122859, 0.00123023, 0.00123188, 0.00123354, 0.00123521, 0.00123689, 0.00123857, 0.00124027, 0.00124197, 0.00124368, 0.00124539, 0.00124712, 0.00124886, 0.0012506, 0.00125235, 0.00125412, 0.00125589, 0.00125767, 0.00125945, 0.00126125, 0.00126306, 0.00126487, 0.0012667, 0.00126853, 0.00127037, 0.00127223, 0.00127409, 0.00127596, 0.00127784, 0.00127973, 0.00128163, 0.00128353, 0.00128545, 0.00128738, 0.00128932, 0.00129126, 0.00129322, 0.00129518, 0.00129716, 0.00129915, 0.00130114, 0.00130315, 0.00130516, 0.00130719, 0.00130922, 0.00131127, 0.00131333, 0.00131539, 0.00131747, 0.00131956, 0.00132166, 0.00132376, 0.00132588, 0.00132801, 0.00133015, 0.0013323, 0.00133446, 0.00133664, 0.00133882, 0.00134101, 0.00134322, 0.00134544, 0.00134766, 0.0013499, 0.00135215, 0.00135441, 0.00135668, 0.00135897, 0.00136126, 0.00136357, 0.00136589, 0.00136822, 0.00137056, 0.00137291, 0.00137527, 0.00137765, 0.00138004, 0.00138244, 0.00138485, 0.00138727, 0.00138971, 0.00139216, 0.00139462, 0.00139709, 0.00139958, 0.00140208, 0.00140459, 0.00140711, 0.00140965, 0.00141219, 0.00141476, 0.00141733, 0.00141992, 0.00142252, 0.00142513, 0.00142775, 0.00143039, 0.00143304, 0.00143571, 0.00143839, 0.00144108, 0.00144379, 0.0014465, 0.00144924, 0.00145198, 0.00145474, 0.00145752, 0.0014603, 0.00146311, 0.00146592, 0.00146875, 0.00147159, 0.00147445, 0.00147732, 0.00148021, 0.00148311, 0.00148603, 0.00148896, 0.0014919, 0.00149486, 0.00149784, 0.00150083, 0.00150383, 0.00150685, 0.00150988, 0.00151293, 0.001516, 0.00151908, 0.00152217, 0.00152528, 0.00152841, 0.00153155, 0.00153471, 0.00153788, 0.00154107, 0.00154428, 0.0015475, 0.00155074, 0.00155399, 0.00155726, 0.00156055, 0.00156385, 0.00156717, 0.00157051, 0.00157386, 0.00157723, 0.00158061, 0.00158402, 0.00158744, 0.00159087, 0.00159433, 0.0015978, 0.00160129, 0.00160479, 0.00160832, 0.00161186, 0.00161542, 0.001619, 0.00162259, 0.0016262, 0.00162984, 0.00163348, 0.00163715, 0.00164084, 0.00164454, 0.00164826, 0.00165201, 0.00165577, 0.00165955, 0.00166334, 0.00166716, 0.001671, 0.00167485, 0.00167872, 0.00168262, 0.00168653, 0.00169046, 0.00169442, 0.00169839, 0.00170238, 0.00170639, 0.00171042, 0.00171448, 0.00171855, 0.00172264, 0.00172675, 0.00173089, 0.00173504, 0.00173922, 0.00174341, 0.00174763, 0.00175187, 0.00175613, 0.00176041, 0.00176471, 0.00176903, 0.00177338, 0.00177775, 0.00178214, 0.00178655, 0.00179098, 0.00179543, 0.00179991, 0.00180441, 0.00180893, 0.00181348, 0.00181804, 0.00182264, 0.00182725, 0.00183188, 0.00183654, 0.00184123, 0.00184593, 0.00185066, 0.00185542, 0.00186019, 0.00186499, 0.00186982, 0.00187467, 0.00187954, 0.00188444, 0.00188936, 0.00189431, 0.00189928, 0.00190428, 0.0019093, 0.00191434, 0.00191942, 0.00192451, 0.00192964, 0.00193478, 0.00193996, 0.00194516, 0.00195038, 0.00195563, 0.00196091, 0.00196622, 0.00197155, 0.00197691, 0.00198229, 0.0019877, 0.00199314, 0.00199861, 0.0020041, 0.00200962, 0.00201517, 0.00202074, 0.00202635, 0.00203198, 0.00203764, 0.00204333, 0.00204904, 0.00205479, 0.00206056, 0.00206637, 0.0020722, 0.00207806, 0.00208395, 0.00208987, 0.00209582, 0.0021018, 0.00210781, 0.00211385, 0.00211991, 0.00212601, 0.00213214, 0.0021383, 0.0021445, 0.00215072, 0.00215697, 0.00216326, 0.00216957, 0.00217592, 0.0021823, 0.00218871, 0.00219516, 0.00220163, 0.00220814, 0.00222125, 0.0022345, 0.00224117, 0.00224788, 0.00225462, 0.00226139, 0.0022682, 0.00227504, 0.00228191, 0.00228882, 0.00229577, 0.00230275, 0.00230976, 0.00231681, 0.00232389, 0.00233101, 0.00233817, 0.00234536, 0.00235259, 0.00235985, 0.00236715, 0.00237448, 0.00238186, 0.00238926, 0.00239671, 0.00240419, 0.00241172, 0.00241927, 0.00242687, 0.0024345, 0.00244218, 0.00244989, 0.00245764, 0.00246543, 0.00247325, 0.00248112, 0.00248902, 0.00249697, 0.00250495, 0.00251298, 0.00252104, 0.00252915, 0.0025373, 0.00254548, 0.00255371, 0.00256198, 0.00257029, 0.00257864, 0.00258703, 0.00259547, 0.00260394, 0.00261246, 0.00262103, 0.00262963, 0.00263828, 0.00264697, 0.00265571, 0.00266449, 0.00267331, 0.00268217, 0.00269108, 0.00270004, 0.00270904, 0.00271809, 0.00272718, 0.00273631, 0.00274549, 0.00275472, 0.00276399, 0.00277331, 0.00278268, 0.00279209, 0.00280156, 0.00281106, 0.00282062, 0.00283022, 0.00283987, 0.00284957, 0.00285932, 0.00286912, 0.00287896, 0.00288886, 0.0028988, 0.00290879, 0.00291884, 0.00292893, 0.00293908, 0.00294927, 0.00295952, 0.00296982, 0.00298017, 0.00299057, 0.00300102, 0.00301152, 0.00302208, 0.00303269, 0.00304336, 0.00305407, 0.00306484, 0.00307567, 0.00308655, 0.00309748, 0.00310847, 0.00311951, 0.00313061, 0.00314176, 0.00315297, 0.00316423, 0.00317555, 0.00318693, 0.00319837, 0.00320986, 0.00322141, 0.00323301, 0.00324468, 0.0032564, 0.00326819, 0.00328003, 0.00329193, 0.00330389, 0.00331591, 0.00332798, 0.00334012, 0.00335233, 0.00336459, 0.00337691, 0.00338929, 0.00340174, 0.00341425, 0.00342682, 0.00343945, 0.00345215, 0.00346491, 0.00347774, 0.00349063, 0.00352968, 0.00354283, 0.00355604, 0.00356932, 0.00358267, 0.00359608, 0.00360956, 0.00362311, 0.00363673, 0.00365041, 0.00366416, 0.00367798, 0.00369187, 0.00370583, 0.00371986, 0.00373396, 0.00374813, 0.00376237, 0.00377668, 0.00379107, 0.00380552, 0.00382005, 0.00383465, 0.00384932, 0.00386407, 0.00387889, 0.00389378, 0.00390875, 0.0039238, 0.00393892, 0.00395411, 0.00396938, 0.00398473, 0.00400015, 0.00401565, 0.00403123, 0.00404689, 0.00406262, 0.00407843, 0.00409433, 0.0041103, 0.00412635, 0.00414248, 0.00415869, 0.00417499, 0.00419136, 0.00420782, 0.00422436, 0.00424098, 0.00425769, 0.00427447, 0.00429135, 0.0043083, 0.00432534, 0.00434247, 0.00435968, 0.00437698, 0.00439437, 0.00441184, 0.0044294, 0.00444704, 0.00446478, 0.0044826, 0.00450052, 0.00451852, 0.00453661, 0.00455479, 0.00457307, 0.00459143, 0.00460989, 0.00462844, 0.00464708, 0.00466582, 0.00468465, 0.00470357, 0.00472259, 0.0047417, 0.00476091, 0.00478021, 0.00479962, 0.00481911, 0.00483871, 0.0048584, 0.0048782, 0.00489809, 0.00491808, 0.00493817, 0.00495836, 0.00497865, 0.00499904, 0.00501954, 0.00504014, 0.00506084, 0.00508164, 0.00510255, 0.00512356, 0.00514468, 0.0051659, 0.00518723, 0.00520867, 0.00523021, 0.00525186, 0.00527362, 0.00529549, 0.00531747, 0.00533955, 0.00536175, 0.00538406, 0.00540648, 0.00542901, 0.00545166, 0.00547442, 0.00549729, 0.00552028, 0.00554338, 0.00556659, 0.00558993, 0.00561338, 0.00563694, 0.00566063, 0.00568443, 0.00570835, 0.0057324, 0.00575656, 0.00578084, 0.00580524, 0.00582977, 0.00585442, 0.00587919, 0.00590409, 0.00592911, 0.00595425, 0.00597952, 0.00600492, 0.00603045, 0.00610779, 0.00613383, 0.00616, 0.0061863, 0.00621273]}} \ No newline at end of file +{"data": {"q": [0.008172, 0.00821286, 0.00825393, 0.0082952, 0.00833667, 0.00837835, 0.00842025, 0.00846235, 0.00850466, 0.00854718, 0.00858992, 0.00863287, 0.00867603, 0.00871941, 0.00876301, 0.00880682, 0.00885086, 0.00889511, 0.00893959, 0.00898429, 0.00902921, 0.00907435, 0.00911973, 0.00916532, 0.00921115, 0.00925721, 0.00930349, 0.00935001, 0.00939676, 0.00944374, 0.00949096, 0.00953842, 0.00958611, 0.00963404, 0.00968221, 0.00973062, 0.00977928, 0.00982817, 0.00987731, 0.0099267, 0.00997633, 0.0100262, 0.0100763, 0.0101267, 0.0101774, 0.0102282, 0.0102794, 0.0103308, 0.0103824, 0.0104344, 0.0104865, 0.010539, 0.0105917, 0.0106446, 0.0106978, 0.0107513, 0.0108051, 0.0108591, 0.0109134, 0.010968, 0.0110228, 0.0110779, 0.0111333, 0.011189, 0.0112449, 0.0113011, 0.0113577, 0.0114144, 0.0114715, 0.0115289, 0.0115865, 0.0116444, 0.0117027, 0.0117612, 0.01182, 0.0118791, 0.0119385, 0.0119982, 0.0120582, 0.0121185, 0.012179, 0.0122399, 0.0123011, 0.0123626, 0.0124245, 0.0124866, 0.012549, 0.0126118, 0.0126748, 0.0127382, 0.0128019, 0.0128659, 0.0129302, 0.0129949, 0.0130599, 0.0131252, 0.0131908, 0.0132567, 0.013323, 0.0133896, 0.0134566, 0.0135239, 0.0135915, 0.0136594, 0.0137277, 0.0137964, 0.0138654, 0.0139347, 0.0140044, 0.0140744, 0.0141447, 0.0142155, 0.0142865, 0.014358, 0.0144298, 0.0145019, 0.0145744, 0.0146473, 0.0147205, 0.0147941, 0.0148681, 0.0149425, 0.0150172, 0.0150923, 0.0151677, 0.0152436, 0.0153198, 0.0153964, 0.0154733, 0.0155507, 0.0156285, 0.0157066, 0.0157851, 0.0158641, 0.0159434, 0.0160231, 0.0161032, 0.0161837, 0.0162647, 0.016346, 0.0164277, 0.0165099, 0.0165924, 0.0166754, 0.0167587, 0.0168425, 0.0169267, 0.0170114, 0.0170964, 0.0171819, 0.0172678, 0.0173542, 0.0174409, 0.0175281, 0.0176158, 0.0177039, 0.0177924, 0.0178813, 0.0179707, 0.0180606, 0.0181509, 0.0182417, 0.0183329, 0.0184245, 0.0185167, 0.0186092, 0.0187023, 0.0187958, 0.0188898, 0.0189842, 0.0190791, 0.0191745, 0.0192704, 0.0193668, 0.0194636, 0.0195609, 0.0196587, 0.019757, 0.0198558, 0.0199551, 0.0200549, 0.0201551, 0.0202559, 0.0203572, 0.020459, 0.0205613, 0.0206641, 0.0207674, 0.0208712, 0.0209756, 0.0210805, 0.0211859, 0.0212918, 0.0213983, 0.0215052, 0.0216128, 0.0217208, 0.0218294, 0.0219386, 0.0220483, 0.0221585, 0.0222693, 0.0223807, 0.0224926, 0.022605, 0.0227181, 0.0228316, 0.0229458, 0.0230605, 0.0231758, 0.0232917, 0.0234082, 0.0235252, 0.0236428, 0.0237611, 0.0238799, 0.0239993, 0.0241193, 0.0242398, 0.024361, 0.0244829, 0.0246053, 0.0247283, 0.0248519, 0.0249762, 0.0251011, 0.0252266, 0.0253527, 0.0254795, 0.0256069, 0.0257349, 0.0258636, 0.0259929, 0.0261229, 0.0262535, 0.0263847, 0.0265167, 0.0266493, 0.0267825, 0.0269164, 0.027051, 0.0271863, 0.0273222, 0.0274588, 0.0275961, 0.0277341, 0.0278727, 0.0280121, 0.0281522, 0.0282929, 0.0284344, 0.0285766, 0.0287194, 0.028863, 0.0290074, 0.0291524, 0.0292982, 0.0294446, 0.0295919, 0.0297398, 0.0298885, 0.030038, 0.0301882, 0.0303391, 0.0304908, 0.0306432, 0.0307965, 0.0309504, 0.0311052, 0.0312607, 0.031417, 0.0315741, 0.031732, 0.0318906, 0.0320501, 0.0322103, 0.0323714, 0.0325333, 0.0326959, 0.0328594, 0.0330237, 0.0331888, 0.0333548, 0.0335215, 0.0336891, 0.0338576, 0.0340269, 0.034197, 0.034368, 0.0345398, 0.0347125, 0.0348861, 0.0350605, 0.0352358, 0.035412, 0.0355891, 0.035767, 0.0359459, 0.0361256, 0.0363062, 0.0364877, 0.0366702, 0.0368535, 0.0370378, 0.037223, 0.0374091, 0.0375961, 0.0377841, 0.037973, 0.0381629, 0.0383537, 0.0385455, 0.0387382, 0.0389319, 0.0391266, 0.0393222, 0.0395188, 0.0397164, 0.039915, 0.0401146, 0.0403151, 0.0405167, 0.0407193, 0.0409229, 0.0411275, 0.0413332, 0.0415398, 0.0417475, 0.0419563, 0.042166, 0.0423769, 0.0425887, 0.0428017, 0.0430157, 0.0432308, 0.0434469, 0.0436642, 0.0438825, 0.0441019, 0.0443224, 0.044544, 0.0447667, 0.0449906, 0.0452155, 0.0454416, 0.0456688, 0.0458972, 0.0461266, 0.0463573, 0.0465891, 0.046822, 0.0470561, 0.0472914, 0.0475279, 0.0477655, 0.0480043, 0.0482443, 0.0484856, 0.048728, 0.0489716, 0.0492165, 0.0494626, 0.0497099, 0.0499584, 0.0502082, 0.0504593, 0.0507116, 0.0509651, 0.05122, 0.0514761, 0.0517334, 0.0519921, 0.0522521, 0.0525133, 0.0527759, 0.0530398, 0.053305, 0.0535715, 0.0538393, 0.0541085, 0.0543791, 0.054651, 0.0549242, 0.0551989, 0.0554749, 0.0557522, 0.056031, 0.0563111, 0.0565927, 0.0568757, 0.0574458, 0.0580217, 0.0583118, 0.0586034, 0.0588964, 0.0591909, 0.0594869, 0.0597843, 0.0600832, 0.0603836, 0.0606855, 0.060989, 0.0612939, 0.0616004, 0.0619084, 0.0622179, 0.062529, 0.0628417, 0.0631559, 0.0634717, 0.063789, 0.064108, 0.0644285, 0.0647506, 0.0650744, 0.0653998, 0.0657268, 0.0660554, 0.0663857, 0.0667176, 0.0670512, 0.0673864, 0.0677234, 0.068062, 0.0684023, 0.0687443, 0.069088, 0.0694335, 0.0697806, 0.0701296, 0.0704802, 0.0708326, 0.0711868, 0.0715427, 0.0719004, 0.0722599, 0.0726212, 0.0729843, 0.0733492, 0.073716, 0.0740846, 0.074455, 0.0748273, 0.0752014, 0.0755774, 0.0759553, 0.0763351, 0.0767167, 0.0771003, 0.0774858, 0.0778733, 0.0782626, 0.0786539, 0.0790472, 0.0794424, 0.0798397, 0.0802389, 0.08064, 0.0810432, 0.0814485, 0.0818557, 0.082265, 0.0826763, 0.0830897, 0.0835051, 0.0839227, 0.0843423, 0.084764, 0.0851878, 0.0856138, 0.0860418, 0.086472, 0.0869044, 0.0873389, 0.0877756, 0.0882145, 0.0886556, 0.0890988, 0.0895443, 0.089992, 0.090442, 0.0908942, 0.0913487, 0.0918054, 0.0922645, 0.0927258, 0.0931894, 0.0936554, 0.0941236, 0.0945943, 0.0950672, 0.0955426, 0.0960203, 0.0965004, 0.0969829, 0.0974678, 0.0979551, 0.0984449, 0.0989371, 0.0994318, 0.099929, 0.100429, 0.100931, 0.101435, 0.101943, 0.102452, 0.102965, 0.103479, 0.103997, 0.104517, 0.105039, 0.105565, 0.106092, 0.106623, 0.107156, 0.107692, 0.10823, 0.108771, 0.109315, 0.109862, 0.110411, 0.110963, 0.111518, 0.112076, 0.112636, 0.114334, 0.114906, 0.11548, 0.116058, 0.116638, 0.117221, 0.117807, 0.118396, 0.118988, 0.119583, 0.120181, 0.120782, 0.121386, 0.121993, 0.122603, 0.123216, 0.123832, 0.124451, 0.125073, 0.125699, 0.126327, 0.126959, 0.127593, 0.128231, 0.128873, 0.129517, 0.130165, 0.130815, 0.131469, 0.132127, 0.132787, 0.133451, 0.134119, 0.134789, 0.135463, 0.13614, 0.136821, 0.137505, 0.138193, 0.138884, 0.139578, 0.140276, 0.140977, 0.141682, 0.142391, 0.143103, 0.143818, 0.144537, 0.14526, 0.145986, 0.146716, 0.14745, 0.148187, 0.148928, 0.149673, 0.150421, 0.151173, 0.151929, 0.152689, 0.153452, 0.154219, 0.15499, 0.155765, 0.156544, 0.157327, 0.158114, 0.158904, 0.159699, 0.160497, 0.1613, 0.162106, 0.162917, 0.163731, 0.16455, 0.165373, 0.1662, 0.167031, 0.167866, 0.168705, 0.169549, 0.170396, 0.171248, 0.172104, 0.172965, 0.17383, 0.174699, 0.175572, 0.17645, 0.177333, 0.178219, 0.17911, 0.180006, 0.180906, 0.18181, 0.18272, 0.183633, 0.184551, 0.185474, 0.186401, 0.187333, 0.18827, 0.189211, 0.190157, 0.191108, 0.192064, 0.193024, 0.193989, 0.194959, 0.195934, 0.196914, 0.197898, 0.198888, 0.199882, 0.200882, 0.201886, 0.202895, 0.20391, 0.204929, 0.205954, 0.206984, 0.208019, 0.209059, 0.210104, 0.211155, 0.21221, 0.213272, 0.214338, 0.21541, 0.216487, 0.217569, 0.218657, 0.21975, 0.220849, 0.221953, 0.223063, 0.226426, 0.227558, 0.228696, 0.229839, 0.230988], "r": [1.00292, 0.971192, 1.15077, 0.986956, 1.11587, 0.868071, 1.03662, 0.975888, 0.921519, 0.963813, 1.13785, 0.879322, 0.904291, 0.960079, 1.05178, 0.937505, 0.852204, 0.92745, 0.949921, 0.941086, 0.990593, 1.06334, 0.850118, 1.02997, 0.981144, 1.06409, 1.0525, 1.01219, 1.17437, 1.02095, 0.972304, 1.00347, 0.980313, 1.0392, 0.885747, 1.1032, 0.928186, 0.974964, 1.11438, 0.989245, 1.0883, 1.06736, 1.03328, 1.11365, 0.867132, 1.11961, 0.982688, 1.10156, 0.993693, 1.09618, 1.10815, 1.13116, 1.02664, 1.19802, 0.971994, 0.855004, 1.06508, 0.710988, 1.16638, 0.795614, 1.04319, 0.978022, 1.16085, 1.08049, 0.925478, 0.890683, 0.926998, 1.23492, 0.92285, 1.03241, 1.02922, 1.13379, 0.91124, 1.1672, 1.11862, 0.977663, 1.00321, 1.27346, 0.942306, 0.975787, 1.00096, 1.04272, 0.901378, 1.07828, 1.40169, 1.18658, 1.06869, 0.60747, 1.09955, 1.30338, 1.27393, 0.712323, 1.08667, 1.26968, 0.99335, 0.793935, 0.805301, 0.704552, 0.998537, 1.37669, 0.745817, 0.997689, 1.01386, 0.848817, 0.987279, 1.1512, 1.03067, 1.16615, 0.819864, 0.854037, 1.23485, 0.98543, 1.12174, 1.12348, 1.04177, 1.13156, 1.01784, 1.22415, 1.18742, 0.978064, 1.04994, 1.195, 1.0653, 1.18844, 0.884946, 0.919997, 0.766168, 1.02155, 1.09101, 0.927982, 1.07516, 1.0108, 1.12633, 0.925146, 0.835491, 0.905745, 0.911295, 0.981521, 0.886403, 1.00407, 1.00255, 0.983482, 1.12563, 0.95987, 1.00391, 1.01212, 0.941355, 1.06561, 0.947267, 1.26844, 1.0539, 1.01119, 1.01191, 0.915213, 1.25082, 1.20032, 1.00709, 1.19384, 1.11701, 0.924855, 1.42254, 1.07455, 1.08506, 1.14755, 1.0508, 1.22673, 1.10784, 1.01769, 1.19105, 1.18333, 1.00153, 1.05151, 0.947062, 1.02145, 1.16664, 0.887597, 1.1837, 0.858938, 0.9389, 1.1025, 0.824691, 0.837882, 0.957074, 0.979177, 1.01209, 0.964635, 0.927921, 0.829201, 0.908633, 1.01934, 0.877527, 0.783077, 0.856552, 0.765909, 0.858218, 0.692793, 0.789756, 0.691225, 0.7381, 0.792627, 0.675245, 0.678238, 0.588589, 0.4956, 0.624768, 0.540253, 0.487914, 0.388434, 0.29552, 0.262364, 0.245016, 0.244247, 0.22012, 0.208477, 0.0984338, 0.0834702, 0.134408, 0.0460322, 0.104583, 0.0701407, 0.0968901, 0.0784045, 0.080036, 0.0933233, 0.0933611, 0.0996699, 0.14349, 0.143021, 0.154417, 0.199931, 0.180384, 0.201729, 0.176713, 0.169209, 0.176325, 0.177329, 0.173372, 0.172186, 0.19886, 0.1693, 0.161824, 0.153135, 0.143997, 0.135123, 0.148046, 0.133631, 0.123411, 0.120676, 0.101916, 0.09243, 0.0788419, 0.0670949, 0.0651125, 0.0410867, 0.0416023, 0.0309742, 0.028229, 0.0204895, 0.0202423, 0.0165425, 0.0114432, 0.0136166, 0.0110706, 0.0145096, 0.0110999, 0.0124228, 0.00825276, 0.0147912, 0.0236032, 0.0200068, 0.0269945, 0.0271531, 0.0297328, 0.028804, 0.0330796, 0.0344553, 0.0390683, 0.0421349, 0.0434423, 0.0440841, 0.042578, 0.0524933, 0.0433906, 0.0466075, 0.0529198, 0.0519203, 0.041759, 0.0466991, 0.0465623, 0.0351167, 0.0390897, 0.0349293, 0.0348531, 0.0332029, 0.0283975, 0.0297603, 0.0252154, 0.0237409, 0.0169114, 0.0151352, 0.0159799, 0.0144532, 0.00994997, 0.010066, 0.00795546, 0.00622054, 0.00536303, 0.00553554, 0.00572172, 0.00293029, 0.00317657, 0.00320922, 0.00202862, 0.00428848, 0.00479759, 0.00505415, 0.0055886, 0.00716625, 0.0059857, 0.00796053, 0.0101988, 0.00917143, 0.00902145, 0.0122506, 0.0125174, 0.0137219, 0.0120376, 0.0141255, 0.0143386, 0.0113002, 0.0128401, 0.00992566, 0.0109588, 0.0107454, 0.0110805, 0.00884727, 0.0120634, 0.00752058, 0.00842594, 0.00774131, 0.00761727, 0.00552107, 0.0044357, 0.00468039, 0.00387187, 0.00474897, 0.00406616, 0.00283662, 0.0030261, 0.00215181, 0.00182975, 0.00214599, 0.00186849, 0.0013744, 0.00131575, 0.00105039, 0.00079614, 0.00124936, 0.002032, 0.00246464, 0.00341765, 0.00218628, 0.00268209, 0.00226943, 0.00156694, 0.00488737, 0.00468206, 0.00319607, 0.00213851, 0.00390668, 0.00377475, 0.00404314, 0.00373381, 0.00314767, 0.00310604, 0.00264213, 0.00286319, 0.00242841, 0.00287563, 0.00167811, 0.00186347, 0.00150979, 0.00115834, 0.000956193, 0.00135321, 0.000975256, 0.00117656, 0.000698104, 0.000985391, 0.000602807, 0.000878607, 0.00109072, 0.000897622, 0.00123703, 0.000890803, 0.00106575, 0.00117098, 0.00124319, 0.00113229, 0.00125115, 0.00139065, 0.00147215, 0.00123702, 0.00110392, 0.00121703, 0.00121689, 0.000994781, 0.000960309, 0.000905197, 0.000877697, 0.000791067, 0.000650816, 0.000626826, 0.000545251, 0.00063976, 0.000495526, 0.000564592, 0.000480068, 0.000514332, 0.000422844, 0.000480304, 0.000541866, 0.00047141, 0.000523089, 0.000377551, 0.000496435, 0.000497835, 0.000420738, 0.000522678, 0.000483264, 0.000482833, 0.000457207, 0.000408057, 0.000482037, 0.000417429, 0.000455811, 0.000354858, 0.000402967, 0.000317876, 0.000320527, 0.000339683, 0.000400798, 0.000366692, 0.000354629, 0.000335668, 0.000331915, 0.000364803, 0.000249298, 0.000300569, 0.000240954, 0.000285774, 0.000278591, 0.000334738, 0.000269736, 0.000274244, 0.000180688, 0.000202035, 0.000135781, 0.000157465, 0.000155504, 0.000131167, 0.000102872, 0.000149093, 0.000197615, 0.000142599, 0.000166956, 0.000203958, 0.000220751, 0.000192277, 0.000245779, 0.000260747, 0.000262128, 0.000268821, 0.000204924, 0.000179931, 0.000179807, 0.000132241, 0.00014404, 0.000112582, 8.24807e-05, 0.000102099, 9.64085e-05, 8.96959e-05, 8.00637e-05, 0.000113314, 0.000101373, 6.93316e-05, 0.000110289, 9.43429e-05, 0.000112602, 0.000154759, 0.000153559, 0.00012149, 0.000163509, 0.000156451, 0.0001304, 0.000119213, 0.000124597, 0.000107769, 8.78461e-05, 6.72209e-05, 4.62037e-05, 6.59568e-05, 4.9187e-05, 3.96607e-05, 3.70079e-05, 4.65372e-05, 5.67716e-05, 9.05437e-05, 9.1959e-05, 0.000122418, 0.000110385, 0.000122651, 9.15517e-05, 0.000112266, 0.000105764, 0.000107731, 0.000106559, 9.14283e-05, 8.68672e-05, 6.79247e-05, 4.86921e-05, 4.31307e-05, 5.22529e-05, 3.91618e-05, 6.19553e-05, 6.59506e-05, 8.20919e-05, 8.81841e-05, 8.23669e-05, 8.85319e-05, 9.62182e-05, 9.3108e-05, 7.70811e-05, 6.6108e-05, 5.96323e-05, 4.91469e-05, 3.7699e-05, 4.40864e-05, 3.85976e-05, 3.24852e-05, 4.28189e-05, 4.92379e-05, 5.63694e-05, 6.41489e-05, 6.36953e-05, 7.58073e-05, 7.71302e-05, 7.14003e-05, 6.77262e-05, 5.35281e-05, 4.97905e-05, 4.12638e-05, 3.7584e-05, 3.74145e-05, 2.63684e-05, 2.77975e-05, 3.47507e-05, 4.18307e-05, 4.0189e-05, 4.7285e-05, 5.20295e-05, 5.42083e-05, 4.79752e-05, 4.10873e-05, 4.33201e-05, 3.86206e-05, 3.19011e-05, 3.15057e-05, 2.60612e-05, 2.49649e-05, 3.19175e-05, 2.85573e-05, 2.7201e-05, 2.89327e-05, 3.16217e-05, 3.12817e-05, 3.18768e-05, 2.76412e-05, 2.96478e-05, 2.93279e-05, 2.44444e-05, 1.94642e-05, 1.98767e-05, 1.97081e-05, 1.84137e-05, 1.89752e-05, 2.07281e-05, 2.01638e-05, 2.0518e-05, 1.96767e-05, 2.57499e-05, 1.89441e-05, 2.01576e-05, 1.85662e-05, 1.71257e-05, 1.29336e-05, 1.02941e-05, 1.41655e-05, 1.36468e-05, 1.58523e-05, 1.82486e-05, 1.75587e-05, 1.48144e-05, 1.55886e-05, 1.21944e-05, 1.00156e-05, 1.25917e-05, 1.19513e-05, 9.98581e-06, 1.07556e-05, 9.96089e-06, 7.95805e-06, 1.20891e-05, 1.1881e-05, 1.15014e-05, 1.19971e-05, 1.18283e-05, 1.00102e-05, 8.51288e-06, 8.33002e-06, 7.78799e-06, 7.14395e-06, 5.82789e-06, 9.72182e-06, 5.61111e-06, 8.55194e-06, 7.63515e-06, 6.11208e-06, 4.21374e-06, 7.30086e-06, 6.68711e-06, 4.2231e-06, 4.21437e-06, 4.35891e-06, 6.41207e-06, 7.63863e-06, 8.02082e-06, 3.77972e-06, 4.43254e-06, 5.48094e-06, 3.83391e-06, 5.05487e-06, 4.94465e-06, 2.744e-06, 6.91534e-06, 2.30264e-06, 5.36865e-06, 5.22637e-06, 3.92417e-06, 2.38112e-06, 5.09107e-06, 2.13432e-06, 3.93496e-06, 3.49014e-06, 3.19194e-06, 5.07744e-06, 4.36514e-06, 3.66655e-06, 4.55321e-06, 4.99929e-06, 4.00323e-06, 2.82518e-06, 2.337e-06, 2.59131e-06], "dr": [0.143562, 0.140376, 0.147066, 0.138312, 0.142276, 0.122621, 0.127989, 0.12624, 0.12117, 0.120155, 0.126179, 0.112469, 0.112921, 0.11231, 0.120441, 0.108001, 0.0982821, 0.104966, 0.108515, 0.105099, 0.0999317, 0.10458, 0.092527, 0.0973013, 0.0972482, 0.0987262, 0.0987666, 0.0938169, 0.0994313, 0.0916201, 0.0868019, 0.0866643, 0.0957968, 0.0982065, 0.0873898, 0.0983046, 0.085203, 0.0915249, 0.0968745, 0.0871783, 0.0871533, 0.08759, 0.0852251, 0.14785, 0.13641, 0.147406, 0.137544, 0.146827, 0.131711, 0.141212, 0.133986, 0.13224, 0.129488, 0.134809, 0.120069, 0.112042, 0.120814, 0.102072, 0.123693, 0.103156, 0.116507, 0.113055, 0.116867, 0.110605, 0.102493, 0.0993741, 0.0989763, 0.111928, 0.0951901, 0.0993264, 0.0980305, 0.104541, 0.0913366, 0.100727, 0.0974528, 0.0887229, 0.0924962, 0.103203, 0.112647, 0.116004, 0.116644, 0.116737, 0.104493, 0.113236, 0.238028, 0.217167, 0.203294, 0.150905, 0.196926, 0.206602, 0.213538, 0.161333, 0.178545, 0.202617, 0.171002, 0.149034, 0.150027, 0.139696, 0.160584, 0.189886, 0.144956, 0.158926, 0.160051, 0.141616, 0.151485, 0.160063, 0.152794, 0.160349, 0.131391, 0.13011, 0.158911, 0.140684, 0.144743, 0.141347, 0.134607, 0.141344, 0.135563, 0.141847, 0.138486, 0.124839, 0.127528, 0.135457, 0.127396, 0.131934, 0.112746, 0.1135, 0.0992348, 0.116975, 0.120495, 0.112075, 0.114944, 0.109077, 0.117531, 0.103928, 0.0974142, 0.100584, 0.101199, 0.100478, 0.095415, 0.103634, 0.103181, 0.0989955, 0.110613, 0.0966819, 0.102029, 0.0927409, 0.0873035, 0.0921, 0.153706, 0.180301, 0.161001, 0.15587, 0.159163, 0.143922, 0.168698, 0.166109, 0.146189, 0.152325, 0.151295, 0.132461, 0.165372, 0.139582, 0.134088, 0.145057, 0.139506, 0.143635, 0.136155, 0.136137, 0.137298, 0.141408, 0.124292, 0.129101, 0.120507, 0.121347, 0.134562, 0.110736, 0.132831, 0.102215, 0.108443, 0.122989, 0.102279, 0.101896, 0.112026, 0.109216, 0.110382, 0.106194, 0.101551, 0.0946836, 0.0996562, 0.107036, 0.0955732, 0.0855743, 0.0924012, 0.0846843, 0.0912598, 0.0785231, 0.0863238, 0.0799711, 0.0788651, 0.0833762, 0.0748302, 0.073964, 0.0713272, 0.060868, 0.0722167, 0.0654142, 0.0597526, 0.0538244, 0.0458957, 0.0433313, 0.0424308, 0.041165, 0.0377424, 0.0379716, 0.026467, 0.0243191, 0.0299691, 0.0183809, 0.0261195, 0.0209121, 0.0250401, 0.0226787, 0.0223993, 0.0234883, 0.0243294, 0.0241258, 0.0285527, 0.0277281, 0.0290187, 0.0323748, 0.031328, 0.0314126, 0.0298074, 0.0288382, 0.0147337, 0.0151648, 0.0140528, 0.0150647, 0.016198, 0.0142444, 0.0137219, 0.0132102, 0.0123794, 0.0127943, 0.00930868, 0.00851283, 0.00803037, 0.00832334, 0.00743699, 0.00676687, 0.00603658, 0.00534526, 0.00529829, 0.00390879, 0.00386728, 0.00348629, 0.00313723, 0.00265151, 0.00273978, 0.00227824, 0.0019756, 0.00216484, 0.00188989, 0.00217689, 0.00181312, 0.00198781, 0.00166266, 0.00209323, 0.00280436, 0.00253923, 0.00278995, 0.00290266, 0.00308674, 0.00287231, 0.00305707, 0.00320022, 0.00367082, 0.00378367, 0.00372019, 0.00385004, 0.00371925, 0.00446067, 0.00384104, 0.00397702, 0.00422683, 0.00428922, 0.00355087, 0.00381995, 0.00385667, 0.00311907, 0.00338182, 0.00316863, 0.00321549, 0.00316987, 0.00285291, 0.002979, 0.00265692, 0.00250095, 0.00212677, 0.00216555, 0.00206639, 0.00210538, 0.00160574, 0.00164621, 0.00147275, 0.00133555, 0.0012465, 0.00133324, 0.00143205, 0.00103801, 0.00102652, 0.000988294, 0.000794098, 0.00114729, 0.00112385, 0.00119684, 0.00119956, 0.00139726, 0.00131576, 0.00145829, 0.00165739, 0.00151106, 0.00154041, 0.00177204, 0.00181606, 0.00186453, 0.001757, 0.00192164, 0.00198164, 0.00163329, 0.0017327, 0.00150664, 0.00162809, 0.00157129, 0.00165577, 0.00147589, 0.00166186, 0.00133863, 0.00142338, 0.00134015, 0.00133894, 0.0011047, 0.00100847, 0.00105066, 0.000968148, 0.00105379, 0.000979444, 0.00085018, 0.000861822, 0.000721294, 0.000703323, 0.000743716, 0.000708914, 0.00058874, 0.000627509, 0.000619435, 0.000593779, 0.000648653, 0.000708966, 0.000779759, 0.000880171, 0.000726099, 0.000802307, 0.000759438, 0.000678727, 0.00103408, 0.00102819, 0.000865933, 0.000729375, 0.000499752, 0.000497742, 0.000553276, 0.000499348, 0.000420713, 0.000440801, 0.000384981, 0.000422662, 0.000401228, 0.000475283, 0.000323406, 0.000359189, 0.000347648, 0.000302771, 0.000253405, 0.000347207, 0.000270138, 0.000304166, 0.000241279, 0.000290394, 0.000219497, 8.53536e-05, 0.0003005, 0.000256147, 0.000314661, 0.000258493, 0.00026753, 0.000283751, 0.000322823, 0.000289032, 0.000102861, 0.000108358, 0.000118719, 0.000101694, 9.14261e-05, 0.000101913, 0.000100895, 8.63978e-05, 8.33671e-05, 8.17164e-05, 8.36303e-05, 7.98841e-05, 6.86318e-05, 6.86178e-05, 6.37824e-05, 7.23849e-05, 6.09289e-05, 6.45962e-05, 5.90799e-05, 6.31051e-05, 5.34182e-05, 5.73674e-05, 6.26992e-05, 5.49863e-05, 5.91543e-05, 4.92624e-05, 5.81507e-05, 5.82673e-05, 5.26238e-05, 6.16637e-05, 5.74421e-05, 5.55663e-05, 5.42189e-05, 5.40547e-05, 5.6791e-05, 5.47041e-05, 5.41302e-05, 4.80854e-05, 5.14189e-05, 4.73259e-05, 4.66573e-05, 4.92597e-05, 5.57258e-05, 5.17542e-05, 5.0589e-05, 4.84001e-05, 4.5989e-05, 5.14605e-05, 4.03888e-05, 4.54e-05, 4.01531e-05, 4.37192e-05, 4.30003e-05, 4.75926e-05, 4.3329e-05, 4.07376e-05, 3.52851e-05, 3.64646e-05, 3.13879e-05, 3.197e-05, 3.10578e-05, 2.8936e-05, 2.83616e-05, 2.99239e-05, 3.34018e-05, 2.93044e-05, 3.16973e-05, 3.38978e-05, 3.65169e-05, 3.51668e-05, 3.81087e-05, 3.86178e-05, 3.92315e-05, 3.91585e-05, 3.43188e-05, 3.17251e-05, 3.14917e-05, 2.81333e-05, 3.05252e-05, 2.59642e-05, 2.31224e-05, 2.51174e-05, 2.44145e-05, 2.30323e-05, 2.30693e-05, 2.46871e-05, 2.39554e-05, 2.0182e-05, 2.6743e-05, 2.36204e-05, 2.68721e-05, 3.0511e-05, 2.90938e-05, 2.62705e-05, 2.96091e-05, 2.95805e-05, 2.7251e-05, 2.7127e-05, 2.9955e-05, 2.4836e-05, 2.3892e-05, 2.05541e-05, 1.75072e-05, 1.0601e-05, 9.71594e-06, 9.49875e-06, 8.02037e-06, 8.4931e-06, 9.62743e-06, 1.19503e-05, 1.15063e-05, 1.37728e-05, 1.3562e-05, 1.46742e-05, 1.10809e-05, 1.37049e-05, 1.28715e-05, 1.32564e-05, 1.33108e-05, 1.26311e-05, 1.17713e-05, 1.16885e-05, 8.97055e-06, 8.7201e-06, 9.89259e-06, 8.43873e-06, 9.37302e-06, 1.04384e-05, 1.21924e-05, 1.21754e-05, 1.05417e-05, 1.24076e-05, 1.3428e-05, 6.46081e-06, 5.56239e-06, 5.09811e-06, 4.92802e-06, 4.13651e-06, 3.49557e-06, 3.94797e-06, 3.5427e-06, 3.1171e-06, 3.66435e-06, 4.04758e-06, 4.69554e-06, 5.13148e-06, 4.82745e-06, 5.5527e-06, 5.74261e-06, 5.30999e-06, 5.15087e-06, 4.34138e-06, 4.23768e-06, 3.78639e-06, 3.54629e-06, 3.5381e-06, 2.91336e-06, 2.81536e-06, 3.16954e-06, 3.63066e-06, 3.55001e-06, 4.00946e-06, 4.17843e-06, 4.4655e-06, 4.07245e-06, 3.60727e-06, 3.76205e-06, 3.55129e-06, 3.16071e-06, 3.14556e-06, 2.75927e-06, 2.70107e-06, 3.15302e-06, 2.98716e-06, 2.95533e-06, 3.18675e-06, 3.47401e-06, 3.2581e-06, 3.38854e-06, 3.0222e-06, 3.05766e-06, 3.01e-06, 2.60505e-06, 2.43157e-06, 2.26844e-06, 2.48918e-06, 2.38755e-06, 2.42889e-06, 2.46858e-06, 2.37956e-06, 2.48621e-06, 2.43534e-06, 2.79845e-06, 2.36134e-06, 2.49151e-06, 2.30205e-06, 2.11306e-06, 1.9884e-06, 1.65242e-06, 1.96205e-06, 1.90605e-06, 2.0711e-06, 2.23865e-06, 2.13635e-06, 1.94884e-06, 2.04773e-06, 1.94767e-06, 1.75802e-06, 1.81618e-06, 1.71624e-06, 1.61162e-06, 1.66517e-06, 1.69622e-06, 1.53716e-06, 1.71996e-06, 1.75911e-06, 1.74292e-06, 1.7116e-06, 1.79622e-06, 1.51725e-06, 1.50141e-06, 1.49965e-06, 1.51918e-06, 1.43582e-06, 1.39389e-06, 1.61419e-06, 1.36693e-06, 1.5177e-06, 1.3817e-06, 1.28712e-06, 1.23896e-06, 1.53262e-06, 1.33132e-06, 1.16413e-06, 1.20268e-06, 1.30002e-06, 1.36266e-06, 1.52538e-06, 1.42844e-06, 1.26132e-06, 1.17553e-06, 1.20089e-06, 1.15134e-06, 1.23911e-06, 1.20598e-06, 1.18421e-06, 1.35398e-06, 1.16865e-06, 1.28973e-06, 1.38865e-06, 1.19477e-06, 1.10254e-06, 1.31804e-06, 9.93385e-07, 1.1268e-06, 1.07586e-06, 1.1222e-06, 1.24669e-06, 1.11755e-06, 1.14503e-06, 1.23252e-06, 1.30625e-06, 1.18134e-06, 9.91102e-07, 1.0445e-06, 1.09342e-06], "dq": [0.00108796, 0.0010889, 0.00108984, 0.00109079, 0.00109174, 0.0010927, 0.00109367, 0.00109463, 0.00109561, 0.00109659, 0.00109757, 0.00109856, 0.00109955, 0.00110055, 0.00110155, 0.00110256, 0.00110357, 0.00110459, 0.00110561, 0.00110664, 0.00110767, 0.00110871, 0.00110975, 0.0011108, 0.00111186, 0.00111292, 0.00111398, 0.00111505, 0.00111613, 0.00111721, 0.00111829, 0.00111938, 0.00112048, 0.00112158, 0.00112269, 0.0011238, 0.00112492, 0.00112605, 0.00112718, 0.00112831, 0.00112946, 0.0011306, 0.00113176, 0.00113291, 0.00113408, 0.00113525, 0.00113643, 0.00113761, 0.0011388, 0.00113999, 0.00114119, 0.0011424, 0.00114361, 0.00114483, 0.00114605, 0.00114728, 0.00114852, 0.00114976, 0.00115101, 0.00115226, 0.00115352, 0.00115479, 0.00115607, 0.00115735, 0.00115863, 0.00115993, 0.00116123, 0.00116253, 0.00116384, 0.00116516, 0.00116649, 0.00116782, 0.00116916, 0.00117051, 0.00117186, 0.00117322, 0.00117459, 0.00117596, 0.00117734, 0.00117872, 0.00118012, 0.00118152, 0.00118293, 0.00118434, 0.00118576, 0.00118719, 0.00118863, 0.00119007, 0.00119152, 0.00119298, 0.00119444, 0.00119592, 0.0011974, 0.00119888, 0.00120038, 0.00120188, 0.00120339, 0.0012049, 0.00120643, 0.00120796, 0.0012095, 0.00121105, 0.0012126, 0.00121417, 0.00121574, 0.00121732, 0.0012189, 0.0012205, 0.0012221, 0.00122371, 0.00122533, 0.00122696, 0.00122859, 0.00123023, 0.00123188, 0.00123354, 0.00123521, 0.00123689, 0.00123857, 0.00124027, 0.00124197, 0.00124368, 0.00124539, 0.00124712, 0.00124886, 0.0012506, 0.00125235, 0.00125412, 0.00125589, 0.00125767, 0.00125945, 0.00126125, 0.00126306, 0.00126487, 0.0012667, 0.00126853, 0.00127037, 0.00127223, 0.00127409, 0.00127596, 0.00127784, 0.00127973, 0.00128163, 0.00128353, 0.00128545, 0.00128738, 0.00128932, 0.00129126, 0.00129322, 0.00129518, 0.00129716, 0.00129915, 0.00130114, 0.00130315, 0.00130516, 0.00130719, 0.00130922, 0.00131127, 0.00131333, 0.00131539, 0.00131747, 0.00131956, 0.00132166, 0.00132376, 0.00132588, 0.00132801, 0.00133015, 0.0013323, 0.00133446, 0.00133664, 0.00133882, 0.00134101, 0.00134322, 0.00134544, 0.00134766, 0.0013499, 0.00135215, 0.00135441, 0.00135668, 0.00135897, 0.00136126, 0.00136357, 0.00136589, 0.00136822, 0.00137056, 0.00137291, 0.00137527, 0.00137765, 0.00138004, 0.00138244, 0.00138485, 0.00138727, 0.00138971, 0.00139216, 0.00139462, 0.00139709, 0.00139958, 0.00140208, 0.00140459, 0.00140711, 0.00140965, 0.00141219, 0.00141476, 0.00141733, 0.00141992, 0.00142252, 0.00142513, 0.00142775, 0.00143039, 0.00143304, 0.00143571, 0.00143839, 0.00144108, 0.00144379, 0.0014465, 0.00144924, 0.00145198, 0.00145474, 0.00145752, 0.0014603, 0.00146311, 0.00146592, 0.00146875, 0.00147159, 0.00147445, 0.00147732, 0.00148021, 0.00148311, 0.00148603, 0.00148896, 0.0014919, 0.00149486, 0.00149784, 0.00150083, 0.00150383, 0.00150685, 0.00150988, 0.00151293, 0.001516, 0.00151908, 0.00152217, 0.00152528, 0.00152841, 0.00153155, 0.00153471, 0.00153788, 0.00154107, 0.00154428, 0.0015475, 0.00155074, 0.00155399, 0.00155726, 0.00156055, 0.00156385, 0.00156717, 0.00157051, 0.00157386, 0.00157723, 0.00158061, 0.00158402, 0.00158744, 0.00159087, 0.00159433, 0.0015978, 0.00160129, 0.00160479, 0.00160832, 0.00161186, 0.00161542, 0.001619, 0.00162259, 0.0016262, 0.00162984, 0.00163348, 0.00163715, 0.00164084, 0.00164454, 0.00164826, 0.00165201, 0.00165577, 0.00165955, 0.00166334, 0.00166716, 0.001671, 0.00167485, 0.00167872, 0.00168262, 0.00168653, 0.00169046, 0.00169442, 0.00169839, 0.00170238, 0.00170639, 0.00171042, 0.00171448, 0.00171855, 0.00172264, 0.00172675, 0.00173089, 0.00173504, 0.00173922, 0.00174341, 0.00174763, 0.00175187, 0.00175613, 0.00176041, 0.00176471, 0.00176903, 0.00177338, 0.00177775, 0.00178214, 0.00178655, 0.00179098, 0.00179543, 0.00179991, 0.00180441, 0.00180893, 0.00181348, 0.00181804, 0.00182264, 0.00182725, 0.00183188, 0.00183654, 0.00184123, 0.00184593, 0.00185066, 0.00185542, 0.00186019, 0.00186499, 0.00186982, 0.00187467, 0.00187954, 0.00188444, 0.00188936, 0.00189431, 0.00189928, 0.00190428, 0.0019093, 0.00191434, 0.00191942, 0.00192451, 0.00192964, 0.00193478, 0.00193996, 0.00194516, 0.00195038, 0.00195563, 0.00196091, 0.00196622, 0.00197155, 0.00197691, 0.00198229, 0.0019877, 0.00199314, 0.00199861, 0.0020041, 0.00200962, 0.00201517, 0.00202074, 0.00202635, 0.00203198, 0.00203764, 0.00204333, 0.00204904, 0.00205479, 0.00206056, 0.00206637, 0.0020722, 0.00207806, 0.00208395, 0.00208987, 0.00209582, 0.0021018, 0.00210781, 0.00211385, 0.00211991, 0.00212601, 0.00213214, 0.0021383, 0.0021445, 0.00215072, 0.00215697, 0.00216326, 0.00216957, 0.00217592, 0.0021823, 0.00218871, 0.00219516, 0.00220163, 0.00220814, 0.00222125, 0.0022345, 0.00224117, 0.00224788, 0.00225462, 0.00226139, 0.0022682, 0.00227504, 0.00228191, 0.00228882, 0.00229577, 0.00230275, 0.00230976, 0.00231681, 0.00232389, 0.00233101, 0.00233817, 0.00234536, 0.00235259, 0.00235985, 0.00236715, 0.00237448, 0.00238186, 0.00238926, 0.00239671, 0.00240419, 0.00241172, 0.00241927, 0.00242687, 0.0024345, 0.00244218, 0.00244989, 0.00245764, 0.00246543, 0.00247325, 0.00248112, 0.00248902, 0.00249697, 0.00250495, 0.00251298, 0.00252104, 0.00252915, 0.0025373, 0.00254548, 0.00255371, 0.00256198, 0.00257029, 0.00257864, 0.00258703, 0.00259547, 0.00260394, 0.00261246, 0.00262103, 0.00262963, 0.00263828, 0.00264697, 0.00265571, 0.00266449, 0.00267331, 0.00268217, 0.00269108, 0.00270004, 0.00270904, 0.00271809, 0.00272718, 0.00273631, 0.00274549, 0.00275472, 0.00276399, 0.00277331, 0.00278268, 0.00279209, 0.00280156, 0.00281106, 0.00282062, 0.00283022, 0.00283987, 0.00284957, 0.00285932, 0.00286912, 0.00287896, 0.00288886, 0.0028988, 0.00290879, 0.00291884, 0.00292893, 0.00293908, 0.00294927, 0.00295952, 0.00296982, 0.00298017, 0.00299057, 0.00300102, 0.00301152, 0.00302208, 0.00303269, 0.00304336, 0.00305407, 0.00306484, 0.00307567, 0.00308655, 0.00309748, 0.00310847, 0.00311951, 0.00313061, 0.00314176, 0.00315297, 0.00316423, 0.00317555, 0.00318693, 0.00319837, 0.00320986, 0.00322141, 0.00323301, 0.00324468, 0.0032564, 0.00326819, 0.00328003, 0.00329193, 0.00330389, 0.00331591, 0.00332798, 0.00334012, 0.00335233, 0.00336459, 0.00337691, 0.00338929, 0.00340174, 0.00341425, 0.00342682, 0.00343945, 0.00345215, 0.00346491, 0.00347774, 0.00349063, 0.00352968, 0.00354283, 0.00355604, 0.00356932, 0.00358267, 0.00359608, 0.00360956, 0.00362311, 0.00363673, 0.00365041, 0.00366416, 0.00367798, 0.00369187, 0.00370583, 0.00371986, 0.00373396, 0.00374813, 0.00376237, 0.00377668, 0.00379107, 0.00380552, 0.00382005, 0.00383465, 0.00384932, 0.00386407, 0.00387889, 0.00389378, 0.00390875, 0.0039238, 0.00393892, 0.00395411, 0.00396938, 0.00398473, 0.00400015, 0.00401565, 0.00403123, 0.00404689, 0.00406262, 0.00407843, 0.00409433, 0.0041103, 0.00412635, 0.00414248, 0.00415869, 0.00417499, 0.00419136, 0.00420782, 0.00422436, 0.00424098, 0.00425769, 0.00427447, 0.00429135, 0.0043083, 0.00432534, 0.00434247, 0.00435968, 0.00437698, 0.00439437, 0.00441184, 0.0044294, 0.00444704, 0.00446478, 0.0044826, 0.00450052, 0.00451852, 0.00453661, 0.00455479, 0.00457307, 0.00459143, 0.00460989, 0.00462844, 0.00464708, 0.00466582, 0.00468465, 0.00470357, 0.00472259, 0.0047417, 0.00476091, 0.00478021, 0.00479962, 0.00481911, 0.00483871, 0.0048584, 0.0048782, 0.00489809, 0.00491808, 0.00493817, 0.00495836, 0.00497865, 0.00499904, 0.00501954, 0.00504014, 0.00506084, 0.00508164, 0.00510255, 0.00512356, 0.00514468, 0.0051659, 0.00518723, 0.00520867, 0.00523021, 0.00525186, 0.00527362, 0.00529549, 0.00531747, 0.00533955, 0.00536175, 0.00538406, 0.00540648, 0.00542901, 0.00545166, 0.00547442, 0.00549729, 0.00552028, 0.00554338, 0.00556659, 0.00558993, 0.00561338, 0.00563694, 0.00566063, 0.00568443, 0.00570835, 0.0057324, 0.00575656, 0.00578084, 0.00580524, 0.00582977, 0.00585442, 0.00587919, 0.00590409, 0.00592911, 0.00595425, 0.00597952, 0.00600492, 0.00603045, 0.00610779, 0.00613383, 0.00616, 0.0061863, 0.00621273]}} diff --git a/tests/get.py b/tests/get.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_post_get.py b/tests/test_post_get.py index a5bd626..c8d9b3c 100644 --- a/tests/test_post_get.py +++ b/tests/test_post_get.py @@ -2,43 +2,45 @@ import hashlib import json import os + import requests def test_post_request(data_server): http_ok = requests.status_codes.codes["OK"] username = os.environ.get("DJANGO_SUPERUSER_USERNAME") - monitor_user = {"username": username, - "password": os.environ.get("DJANGO_SUPERUSER_PASSWORD")} + monitor_user = {"username": username, "password": os.environ.get("DJANGO_SUPERUSER_PASSWORD")} print(monitor_user) # load html plot as autoreduce service - file_name = 'reflectivity.html' + file_name = "reflectivity.html" files = {"file": open(data_server.path_to(file_name)).read()} monitor_user["data_id"] = file_name - http_request = requests.post("http://127.0.0.1:80/plots/REF_L/12345/upload_plot_data/", - data=monitor_user, files=files, verify=True) + http_request = requests.post( + "http://127.0.0.1:80/plots/REF_L/12345/upload_plot_data/", data=monitor_user, files=files, verify=True + ) assert http_request.status_code == http_ok # load json plot a user "someuser" of the web-reflectivity app - file_name = 'reflectivity.json' - with open(data_server.path_to(file_name), 'r') as file_handle: + file_name = "reflectivity.json" + with open(data_server.path_to(file_name), "r") as file_handle: files = {"file": json.dumps(json.load(file_handle))} monitor_user["data_id"] = file_name - http_request = requests.post("http://127.0.0.1:80/plots/" + username + "/upload_user_data/", - data=monitor_user, files=files, verify=True) + http_request = requests.post( + "http://127.0.0.1:80/plots/" + username + "/upload_user_data/", data=monitor_user, files=files, verify=True + ) assert http_request.status_code == http_ok monitor_user.pop("data_id") # get all plots for an instrument - http_request = requests.post("http://127.0.0.1:80/plots/REF_L/list/", - data=monitor_user, files={}, verify=True) + http_request = requests.post("http://127.0.0.1:80/plots/REF_L/list/", data=monitor_user, files={}, verify=True) assert http_request.status_code == http_ok # get all plots from someuser - http_request = requests.post("http://127.0.0.1:80/plots/" + username + "/list/", - data=monitor_user, files={}, verify=True) + http_request = requests.post( + "http://127.0.0.1:80/plots/" + username + "/list/", data=monitor_user, files={}, verify=True + ) assert http_request.status_code == http_ok @@ -51,15 +53,18 @@ def test_get_request(data_server): # upload the run data using POST (authenticate with username and password) username = os.environ.get("DJANGO_SUPERUSER_USERNAME") - monitor_user = {"username": username, - "password": os.environ.get("DJANGO_SUPERUSER_PASSWORD")} + monitor_user = {"username": username, "password": os.environ.get("DJANGO_SUPERUSER_PASSWORD")} # load html plot as autoreduce service - file_name = 'reflectivity.html' + file_name = "reflectivity.html" files = {"file": open(data_server.path_to(file_name)).read()} monitor_user["data_id"] = file_name - http_request = requests.post(f"http://127.0.0.1:80/plots/{instrument}/{run_number}/upload_plot_data/", - data=monitor_user, files=files, verify=True) + http_request = requests.post( + f"http://127.0.0.1:80/plots/{instrument}/{run_number}/upload_plot_data/", + data=monitor_user, + files=files, + verify=True, + ) assert http_request.status_code == http_ok base_url = f"http://127.0.0.1:80/plots/{instrument}/{run_number}/update/html/" @@ -84,10 +89,10 @@ def test_get_request(data_server): def _generate_key(instrument, run_id): """ - Generate a secret key for a run on a given instrument - Used to simulate clients sending GET-requests using a secret key - @param instrument: instrument name - @param run_id: run number + Generate a secret key for a run on a given instrument + Used to simulate clients sending GET-requests using a secret key + @param instrument: instrument name + @param run_id: run number """ secret_key = os.environ.get("LIVE_PLOT_SECRET_KEY") if len(secret_key) == 0: