Skip to content

Commit

Permalink
Merge pull request #40 from ergodicio/multi-species-1
Browse files Browse the repository at this point in the history
Updates to RTD
  • Loading branch information
almilder authored Dec 19, 2023
2 parents ce689d2 + d1e928f commit 5961392
Show file tree
Hide file tree
Showing 19 changed files with 371 additions and 138 deletions.
22 changes: 17 additions & 5 deletions configs/1d/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,35 @@ other:
refit_thresh: 0.25
calc_sigmas: False

plotting:
n_sigmas: 3
rolling_std_width: 5
data_cbar_u: data
data_cbar_l: 0


data:
shotnum: 101675
shotDay: False
launch_data_visualizer: True
fit_rng:
blue_min: 450
blue_max: 510
red_min: 540
red_max: 625
red_min: 545
red_max: 650
iaw_min: 525
iaw_max: 528
iaw_cf_min: 526.4
iaw_cf_max: 526.6
bgscaleE: 1.0
bgscaleI: 0.1
bgshotmult: 1
ion_loss_scale: 1.0
ele_t0: 0
ion_t0_shift: 0.0
ele_lam_shift: -2.0
dpixel: 2
ele_lam_shift: 0.0
probe_beam: P9
dpixel: 3
lineouts:
type:
pixel
Expand Down Expand Up @@ -169,7 +181,7 @@ optimizer:
y_norm: True
x_norm: False
grad_method: AD
batch_size: 2
batch_size: 4
num_epochs: 200
learning_rate: 1.0e-4
parameter_norm: True
Expand Down
110 changes: 73 additions & 37 deletions configs/1d/inputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,70 @@ parameters:
lb: 0.01
ub: 3.75
amp3:
val: 1.
active: False
lb: 0.
ub: 10.
val: 1.0
active: True
lb: 0.01
ub: 3.75
lam:
val: 524.0
val: 526.5
active: True
lb: 523.
ub: 528.
lb: 523.0
ub: 528.0
Te:
val: .5
val: .500
active: True
lb: 0.001
lb: 0.01
ub: 1.5
gradient: 0.
Te_gradient:
val: 0.0
active: False
lb: 0.
ub: 10.
num_grad_points: 1
Ti:
val: .2
val: 0.05
active: True
lb: 0.001
ub: 1.0
Z:
val: [1., 6.]
active: False
lb: 0.5
ub: 7.0
A:
val: [1., 14.]
active: False
lb: 0.01
ub: 3.
Z:
val: 8.
active: False
lb: 1.
ub: 25.
A:
val: 40
ud:
val: 0.0
active: True
lb: -100.0
ub: 100.0
Va:
val: 0.0
active: False
lb: -20.5
ub: 20.5
ne:
val: .2
active: True
lb: .001
ub: 1.
gradient: 0.
val: 0.35
active: False
lb: 0.001
ub: 1.0
ne_gradient:
val: 0.
active: False
lb: 0.
ub: 15.
num_grad_points: 1
m:
val: 3.
active: True
lb: 2.
ub: 5.
val: 2.4
active: False
lb: 2.0
ub: 5.0
fe:
val: []
active: False
Expand All @@ -57,23 +82,34 @@ parameters:
DLM:
lb: -100.
ub: -0.5
blur:
val: []
active: False
lb: 0.
ub: 10.
specCurvature:
val: []
active: False
lb: .1
ub: 10.
fitprops:
val: []
active: False
fe_decrease_strict: False
symmetric: False

data:
shotnum: 106315
lineouts:
type:
um
start: -1000
end: 1000
skip: 20
background:
type:
Fit
slice: 900

other:
extraoptions:
load_ion_spec: True
load_ele_spec: True
fit_IAW: True
fit_EPWb: False
fit_EPWr: False
refit: False
refit_thresh: 5.0
calc_sigmas: True


mlflow:
experiment: inverse-thomson-scattering
run: shot_106315_simul_f14_ion_only
6 changes: 6 additions & 0 deletions docs/source/FAQ.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FAQ
---------------------------------

*Have questions?*

Please reach out and ask, we will add the common ones here.
51 changes: 51 additions & 0 deletions docs/source/best_practice.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Best Practices for Fitting
================================

This page gives input deck snippets which produce the highest quality fits using TSADAR. It is recomended that
when fitting new data a small region of the data is fit with a small number of lineouts. This can be accomplished
by setting the :code:`lineouts: start` and :code:`lineouts: end` to be close or increasing :code:`lineouts: skip`.
This will allow fast fits that can be used to dial in the starting conditions and the free parameters.
This can also be used to check and adjust the fitting ranges. Once the best inital conditions have been identified
the entire dataset can be fit.

Background and lineout selection
---------------------------------

There are multiple options for background algorithms and types of fitting. These tend to be the best options for
various data types. All of these options are editable in the input deck.

**Best operation for time resolved data:**

.. code-block:: yaml
background:
type: pixel
slice: 900
**Best operation for spatially resolved data:**

.. code-block:: yaml
background:
type: fit
slice: 900 <or background slice for IAW>
**Best operation for lineouts of angular:**

.. code-block:: yaml
background:
type: fit
slice: <background shot number>
**Best operation for full angular:**

.. code-block:: yaml
background:
type: fit
val: <background shot number>
lineouts:
type: range
start: 90
end: 950
6 changes: 6 additions & 0 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Contributing
---------------------------------

If there are new features you would like to see we encourage you to add to the isssues page on Github
or contribute yourself. To contribute, please fork the reposotory or create your own branch. When its time to merge
please provide an email so we can give you credit and in case we have any questions.
4 changes: 4 additions & 0 deletions docs/source/defaults.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Default options
---------------------------------

*Coming Soon*
4 changes: 4 additions & 0 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Examples
---------------------------------

*Coming Soon*
24 changes: 18 additions & 6 deletions docs/source/usage.rst → docs/source/getting_started.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Installation and Usage
==============================
Getting Started
================

*Only MacOS and Linux supported at this time. It may or may not work on Windows but is not yet tested so YMMV*

1. Clone the repo
1. Clone the repo to the local or remote machine where you will be running analysis

2. Install using below instructions or your own way

Expand All @@ -18,13 +18,19 @@ Installation and Usage
source venv/bin/activate # activate the new environment
pip install -r requirements.txt # install dependencies
**Conda**
**Conda CPU**

.. code-block:: bash
mamba env create -f env.yml
mamba activate ts-cpu
conda env create -f env.yml
conda activate tsadar-cpu
**Conda GPU**

.. code-block:: bash
conda env create -f env-gpu.yml
conda activate tsadar-gpu
**Run command**

Expand All @@ -41,3 +47,9 @@ And the other just performs a forward pass and gives you the spectra given some
.. code-block:: bash
python run_tsadar.py --cfg <path>/<to>/<inputs>/<folder> --mode forward
The inputs for the code are stored in an input deck. The default location for this input deck and therefore
the starting path for running jobs is :code:`inverse_thomson_scattering/config/1d`. These inputs should be
modified to change the specific to fit your analysis needs. More information on the Input deck can be found
on the :ref:`inputs` page.
19 changes: 12 additions & 7 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Welcome to TSADAR!
==================================

TSADAR is a Thomson scattering data analysis software written in Python. It helps determine plasma parameters given
Thomson scattering measurements by fitting the observed spectra to known parameterized functional forms. More detail on
the theory is provided elsewhere [1] and will be added to this documentation soon.
Thomson scattering measurements by fitting the collisionless spectral density function to the observed spectra.
More detail on the theory is provided elsewhere [1] and the specifics of implementation can be found in :doc:`math`.

The fitting is performed via gradient descent. The gradients are acquired using automatic differentiation and JAX [2].
More details on the numerics will be added soon.
Expand All @@ -18,13 +18,18 @@ More details on the numerics will be added soon.
:maxdepth: 2
:caption: Contents:

usage
input
fitting

getting_started
best_practice
examples
inputs
defaults
FAQ
math
contributing

*What does TSADAR stand for?*

TBD
Thomson Scattering with Automatic Differentiation for Analysis and Regression



Expand Down
Loading

0 comments on commit 5961392

Please sign in to comment.