Commit 223d9951 authored by Borreguero Calvo, Jose's avatar Borreguero Calvo, Jose
Browse files

Merge branch 'localdev' into 'next'

Containerize the Remote-Worker Server

See merge request !14
parents bcf975f9 df33a561
Pipeline #186849 failed with stages
in 3 seconds
......@@ -9,3 +9,15 @@ DJANGO_SUPERUSER_EMAIL=webreflect@localhost
APP_SECRET='y&#94bnh&4zw3s)0h2&f$ve87_1c_t*+hxfl=2v9429^75-t03'
SETTINGS_DIR=/var/www/web_reflectivity/app/web_reflectivity
C_FORCE_ROOT=true
###
# Remote worker
###
TEST_USER_NAME=testuser
TEST_USER_PASSWD=feg56PUV
TEST_USER_EMAIL=tester@example.com
# Valid options to choose are ('localhost', 'analysis.sns.gov')
JOB_HANDLING_HOST=localhost
JOB_HANDLING_PORT=22
# Valid options to choose are ('/tmp', '~')
REFL1D_JOB_DIR='/tmp'
JOB_HANDLING_INTERPRETER='python'
# latest miniconda3 image
FROM continuumio/miniconda3
ENV PYTHONUNBUFFERED 1
ENV CFLAGS "-std=c++11"
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV LC_COLLATE C
ENV LC_CTYPE en_US.UTF-8
WORKDIR /opt/refl1d
COPY . .
# This line will throw error if using an old miniconda3 image.
# To correct, one must build a miniconda3 image while piling all apt-get statements together into one
# https://hub.docker.com/r/continuumio/miniconda3/dockerfile
RUN apt-get update && apt-get install -y vim emacs iputils-ping net-tools openssh-client openssh-server
RUN conda install --name base -c conda-forge mamba
RUN mamba env update --name base --file environment.yml
# Will start conda environment when $HOME/.bashrc is invoked
RUN echo "source /etc/profile.d/conda.sh" >> /etc/skel/.bashrc
RUN echo "conda activate base" >> /etc/skel/.bashrc
# test installation
RUN cd /tmp && git clone https://github.com/reflectometry/refl1d.git && cd refl1d/ && git checkout tags/v0.8.15
RUN cd /tmp/refl1d/ && pytest ./tests
CMD ["/bin/bash"]
#!/bin/bash
set -e # stop and exit script if any command or pipeline returns
# crate account for test user
useradd -m -p $(openssl passwd -crypt ${TEST_USER_PASSWD}) -s /bin/bash -G users ${TEST_USER_NAME}
# start the ssh daemon
/etc/init.d/ssh start
# hack preventing container from exiting
tail -f /dev/null
name: refl1d
channels:
- conda-forge
dependencies:
- python=3.8
- pip
- cython
- numpy
- scipy
- matplotlib
- wxpython
- git
- pytest
- pytest-cov
- pip:
- refl1d==0.8.15
====================
A Manual Fit Session
====================
This page describes the steps one takes when fitting 1D reflectivity data on the web application, starting at
the point when one logs in the application.
After login in, click in `Choose File` in order to select file `double_layer.txt` found in directory `test/data/`. After
selecting the file, click in `Submit` in order to upload the file. The file will show up in the list of uploaded files.
.. image:: images/a_manual_fit_1.png
:width: 800px
:align: center
:alt: file double_later.txt uploaded
Click in the link `click to fit`. A default initial layer structure will be shown near the bottom of the model page:
.. image:: images/a_manual_fit_2.png
:width: 800px
:align: center
:alt: default layer structure
The default layer structure has only one layer, limited by air and Si on both sides. The solution layer structure
contains two layers with specific thickness and other properties, namely
.. image:: images/a_manual_fit_3.png
:width: 800px
:align: center
:alt: solution layer structure
Thus, we must include an additional layer into the default initial layer structure. We use the "+" button for that
(in the below picture, enclosed in the dashed-line red circle). However, before adding a layer we must evaluate
or fit the current model. Press on the `Evaluate` button (in the below picture, enclosed in the dashed-line
purple circle)
.. image:: images/a_manual_fit_4.png
:width: 800px
:align: center
:alt: evaluating the model
The evaluation prints the current model curve on top of the data. The plot is located near the top of the model page.
As one would expect, the initial model is a poor fit of the data:
.. image:: images/a_manual_fit_5.png
:width: 800px
:align: center
:alt: a poor fit
The poor fit is of little consequence now. Let's click in the "+" button now to add a new layer. This is the current
model with two layers:
.. image:: images/a_manual_fit_6.png
:width: 800px
:align: center
:alt: two-layer bad model
We enter the parameters of the solution layer structure into the model:
.. image:: images/a_manual_fit_7.png
:width: 800px
:align: center
:alt: solution entered
This should provide a model curve closely fitting the data. We're going to create an initial guess for the fit
starting with these optimal parameters. We just distort the two thickness parameters for layers A and B. The goal is
to recover the solution thickness when we fit the model. In this case we entered initial values of 500 and 40
Angstroms for layers `A` and `B`, respectively (red circle in the below picture). Also, we removed the nearby
checkmarks, indicating these are fit parameters (purple circle in the below picture). When a parameter is unchecked,
a `min` and `max` range becomes available (range rectangle in the below picture). We have adjusted the ranges so
that our initial guesses fall right in the middle of the ranges:
.. image:: images/a_manual_fit_8.png
:width: 800px
:align: center
:alt: initial guess
Click the `Evaluate` button to see how our initial guess aligns with the data. We find an "out-of-phase" fit:
.. image:: images/a_manual_fit_9.png
:width: 800px
:align: center
:alt: out-of-phase fit
We now fit the model by clicking in the `Fit` button. The job is submitted to the (local or remote) work server
and fits results will be available once the fit job is finished. A message at the top of the page indicates
this is so, with a link to display the fit:
.. image:: images/a_manual_fit_10.png
:width: 200px
:align: center
:alt: fit results are ready
After clicking in the link, we can inspect the fit to the data and the fit parameters
.. image:: images/a_manual_fit_11.png
:width: 800px
:align: center
:alt: fitted curve
.. image:: images/a_manual_fit_12.png
:width: 800px
:align: center
:alt: fitted parameters
We obtain thicknesses `578.3` and `42.89` (compare to given solution parameters `577.6` and `44.75`).
If so desired, we can save the fit by clicking in the `save model` link (red circle in the below picture):
.. image:: images/a_manual_fit_13.png
:width: 800px
:align: center
:alt: save model
A pop-up will confirm the model was saved:
.. image:: images/a_manual_fit_14.png
:width: 200px
:align: center
:alt: confirmation of model saved
Close the pop-up by clicking in the `OK` button. Then, click in the `show models` button (red circle in the below
picture):
.. image:: images/a_manual_fit_15.png
:width: 800px
:align: center
:alt: confirmation of model saved
The model will show at the top of the list of available models:
.. image:: images/a_manual_fit_16.png
:width: 800px
:align: center
:alt: list of available models
Clicking in the pencil button (red circle in the picture above) will show the fit parameters:
.. image:: images/a_manual_fit_17.png
:width: 500px
:align: center
:alt: fit parameters for the selected saved model
This finishes the manual fit session!
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment