Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected english mistakes in documentation files #151

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions docs/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FAQ
=================

1. Precission Loss
1. Precision Loss
^^^^^^^^^^^^^^^^^^

::
Expand All @@ -12,9 +12,9 @@ FAQ

Check the jac value,

1.1 If all absulute value is small. it is acceptable beacuse of the precision.
1.1 If all absulute values are small. it is acceptable because of the precision.

1.2 If some absulte value is large. It is the bad parameters or problem in models.
1.2 If some absolute values are large. It is due to the bad parameters or some problem in the models.

1.3 Avoid negative weights

Expand All @@ -28,34 +28,34 @@ Check the jac value,
2.1 Check the data.
-------------------

There a script (scripts/check_nan.py) to check it.
There is a script (scripts/check_nan.py) to check it.

2.1.1 No stange value in data, (nan, infs ...).
2.1.1 No strange value in data, (nan, infs ...).

2.1.2 The data order should be :math:`E, p_x, p_y,p_z`, :math:`E` is the first.

2.1.3 The mass should be valid, :math:`E^2 - p_x^2 - p_y^2 - p_z^2 > 0`, and for any combinations of final particles, mab > ma + mb.
2.1.3 The mass should be valid, :math:`E^2 - p_x^2 - p_y^2 - p_z^2 > 0`, and for any combination of final particles, mab > ma + mb.

2.1.4 Avoid 0 in weights.
2.1.4 Avoid including 0 in the weights.


2.2 Check the model.
--------------------

2.2.1 The resonaces mass should be valid, for example in the mass range (m1+m2, m0-m3), out of the threshold required special options.
2.2.1 The resonances mass should be valid, for example in the mass range (m1+m2, m0-m3), out of the threshold required for special options.

3. NaN value when getting params error.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

numpy.linalg.LinAlgError: Array must not contain infs or NaN.
numpy.linalg.LinAlgError: Arrays must not contain infs or NaN.

3.1 Similar as sec 2.2.

3.2 Bad fit parameters: too wide width or two narrow width, reach the boundary and so on.
3.2 Bad fit parameters: width too narrow or wide, reach the boundary and so on.

3.3 Bad gradients. No gradients or the gradients is not corret for fit paramters.
3.3 Bad gradients. No gradients or the gradients are not correct for fit paramters.

4. Singular Matrix when getting params error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -64,17 +64,17 @@ There a script (scripts/check_nan.py) to check it.

numpy.linalg.LinAlgError: Singular matrix

4.1 Free paramters are not used in model.
4.1 Free parameters are not used in the model.

4.2 Used numpy for calculation of variable. The calculation have to be done in get_amp with TensorFlow.
4.2 Used numpy for calculation of variable. The calculations have to be done in get_amp with TensorFlow.

.. code::

...
def init_params(self):
self.a = self.add_var("a")
def get_amp(self, data, *args, **kwargs):
# avoid use numpy for varible as
# avoid using numpy for variable as
a = np.sin(self.a())
# use tensorflow instead
a = tf.sin(self.a())
Expand All @@ -100,9 +100,9 @@ There a script (scripts/check_nan.py) to check it.
data:
lazy_call: True

5.1.3 Try to use small data sample, or simple cases (less final particles).
5.1.3 Try to use a small data sample, or simpler cases (less final particles).

5.1.4 Some speical model required large memory (such as interpolation model), try other model.
5.1.4 Some special models require large memory (such as an interpolation model), try another model.

5.2 CPU
-------------------
Expand Down Expand Up @@ -134,18 +134,18 @@ Check the yaml file (see https://yaml.org): the indent, speical chars :code:`,:}

AssertionError: not only one top particle

The decay chain should be complete. All the item in decay should decay from initial to finals.
The decay chain should be complete. All the item in decay chain should decay from initial to final state.


6.3 Decay chain 2
-----------------

::

RuntimeError: not decay chain aviable, check you config.yml
RuntimeError: not decay chain available, check your config.yml

6.3.1 Similar as sec 6.2.

6.3.2 Check the information in *remove decay chain*, see the reson why those decays are not aviable.
6.3.2 Check the information in *remove decay chain*, see the reason why those decays are not available.

*ls not aviable* means no possible LS combination allowed. Check the spin and parity. If allow parity voilate, add :code:`p_break: True` to decay.
*ls not available* means no possible LS combination allowed. Check the spin and parity. If parity is allowed to be violated, add :code:`p_break: True` to decay.
2 changes: 1 addition & 1 deletion docs/amplitude.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Amplitude
Helicity Formula
________________

Each Decay has Amplitude like
Each Decay has Amplitude defined like:

.. math::
A^{A \rightarrow B+C}_{\lambda_{A},\lambda_{B},\lambda_{C}} = H_{\lambda_{B},\lambda_{C}}^{A \rightarrow B+C} D^{J_{A}\star}_{\lambda_{A},\lambda_{B}-\lambda_{C}}(\phi,\theta,0)
Expand Down
6 changes: 3 additions & 3 deletions docs/custom_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ We can also add parameters in the `.Model` ``init_params`` using ``self.add_var(
return tf.complex( m + self.a(), zeros)

Then a parameters ``{particle_name}_a`` will appear in the parameters, we use ``self.a()`` to get the value in ``get_amp``.
Note, the type of return value should be ``tf.complex``. All builtin model is located in ``tf_pwa/amp.py``.
Note, the type of return value should be ``tf.complex``. All built in models are located in ``tf_pwa/amp.py``.



Expand All @@ -75,9 +75,9 @@ There is a simple method to define Resonance model, like
def r_line(m, a: FloatParams = 1.0):
return m + a

Those code will build a class similar as Line model define before.
Those code will build a class similar as Line model defined before.
By using `inspect` module, we can get the `FullArgSpec` of a function.
For a keyword arguments with type annotation as `FloatParams`, it will be treated as a fit paraments.
For a keyword arguments with type annotation as `FloatParams`, it will be treated as a fit parameter.

.. note::
the first arguments have to be the invariant mass `m` of the resonance.
2 changes: 1 addition & 1 deletion docs/decay_topology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ there are the three possible decay chains of A -> B,C,D ::

the process is unique for different final particles

Each inserting process delete a line and add three new line,
Each process inserted, deletes a line and adds three new lines.
So for decay process has :math:`n` final particles, there are :math:`(2n-3)!!` possible decay topology.
26 changes: 12 additions & 14 deletions docs/developer.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
Setup for Developer Enveriment
------------------------------
Setup for Developer Environment
-------------------------------

.. note::
Before the developing, creating a standalone enveriment is recommanded (see https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands for more).
Before developing, creating a standalone environment is recommended (see https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands for more).

The main steps are similar to the normal installation process; however, two additional steps are to be performed here.

The main steps are similar as normal install, only two extra things need to be done.

The first things is writing tests, and tests your code.
We use pytest (https://docs.pytest.org/en/stable/) framework, You should install it.
The first thing is writing tests and then testing your code.
We use pytest (https://docs.pytest.org/en/stable/) framework for the same, it should be installed as well.

.. code::

conda install pytest pytest-cov pytest-benchmark


The other things is `pre-commit`. it need for developing.
The other thing is `pre-commit`. It is needed for development.

1. You can install `pre-commit` as

Expand All @@ -29,24 +27,24 @@ and

.. code::

conda install pylint # local dependences
conda install pylint # local dependencies
pre-commit install

You can check if pre-commit is working well by running
You can check if pre-commit is working well by running:

.. code::

pre-commit run -a

It may take some time to install required package.
It may take some time to install required packages.

.. note::
If there are some `GLIBC_XXX` errors at this step, you can try to install `node.js`.

.. note::
For developer using editor with formatter, you should be careful for the options.
For developers using an editor with a formatter, you should be careful about the options.

The following are all commands needed
The following are all commands needed:

.. code::

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A detailed configuration file sample (with all usable parameters) can be found *
amplitude
custom_model
decay_topology
resonacnes_params
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the filename of rst.
git mv resonacnes_params.rst resonances_params.rst

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, sorry yes I have changed the filename

resonances_params
phasespace
resolution
auto_examples/index
Expand Down Expand Up @@ -66,7 +66,7 @@ and then fit the data.

Fitting is the major part of an analysis, and it could also be the most time-consuming part.
For this example (the complexity of the amplitude expression matters a lot), the time for fitting is about xxx (running on xxxGPU).
Then we can step further to complete the analysis, like calculating the fit fractions.
Then we can go one step ahead to complete the analysis, and calculate the fit fractions.

.. code-block:: python

Expand Down
30 changes: 15 additions & 15 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Install
To use TFPWA, we need some dependent packages. There are two main ways,
`conda` and `virtualenv` you can choose *one* of them. *Or* you can choose other method in :ref:`other-method`

1. vitrual environment
1. virtual environment
----------------------

To avoid conflict of dependence, we recommed to use vitrual environment. there are two main vitrual environment for python packages,
Expand Down Expand Up @@ -62,9 +62,9 @@ and then you can install packages in the conda environment

.. code::

source ./tfpwa/bin/activete
source ./tfpwa/bin/activate

- 1.2.5 You can exit the environment by
- 1.2.5 You can exit the environment by

.. code::

Expand Down Expand Up @@ -104,10 +104,10 @@ When using `virtualenv`, there is also simple way to install tensorflow2
You can use `-i https://pypi.tuna.tsinghua.edu.cn/simple` option to use pypi mirror site.


3. Other dependences
--------------------
3. Other dependencies
---------------------

Other dependences of TFPWA is simple.
Other dependencies of TFPWA is simple.


3.1 Get TFPWA package
Expand All @@ -124,16 +124,16 @@ Get the packages using
3.2 conda
`````````

3.2.1 other dependences
3.2.1 other dependencies

In conda environment, go into the directory of `tf-pwa`, you can install the rest dependences by
In conda environment, go into the directory of `tf-pwa`, you can install rest of the dependencies by

.. code::

conda install --file requirements-min.txt

.. note::
we recommed Ampere card users to install with
we recommend Ampere card users to install with
`tensorflow_2_6_requirements.txt` (see this
`technical FAQ <https://tf-pwa.readthedocs.io/en/latest/tensorflow_version.html>`_).

Expand All @@ -156,7 +156,7 @@ Using `-e`, so it can be updated by `git pull` directly.
3.3 virtualenv
``````````````

In virtualenv, You can install dependences and TFPWA together.
In virtualenv, You can install dependencies and TFPWA together.

.. code::

Expand All @@ -165,10 +165,10 @@ In virtualenv, You can install dependences and TFPWA together.
Using `-e`, so it can be updated by `git pull` directly.


4. (option) Other dependences.
-------------------------------
4. (option) Other dependencies.
--------------------------------

There are some option packages, such as `uproot` for reading root file.
There are some optional packages, such as `uproot` for reading root file.

4.1 conda
`````````
Expand Down Expand Up @@ -200,7 +200,7 @@ We also provided other install method.
5.1 conda channel (experimental)
````````````````````````````````

A pre-built conda package (Linux only) is also provided, just run following
A pre-built conda package (Linux only) is also provided, just run the following
command to install it.

.. code::
Expand All @@ -209,7 +209,7 @@ command to install it.
conda install tf-pwa

5.2 pip
````````
``````````

When using `pip`, you will need to install CUDA to use GPU. Just run the
following command :
Expand Down
8 changes: 4 additions & 4 deletions docs/phasespace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ by using the property of :math:`\delta`-function,

where :math:`x_i` is the root of :math:`f(x)=0`.

Phase space has the follow chain rule,
Phase space has the following chain rule,

.. math::
\mathrm{d} \Phi(P;p_1,\cdots,p_n) =& (2\pi)^4\delta^4(P - \sum {p_i}) \prod \frac{1}{2E_i}\frac{\mathrm{d}^3 \vec{p_i}}{(2\pi)^{3}} \\
Expand Down Expand Up @@ -48,14 +48,14 @@ where :math:`\mathrm{d} \Omega = \mathrm{d}(\cos\theta)\mathrm{d}\varphi` and
|\vec{p}| = \frac{\sqrt{(M^2 - (m_1 + m_2)^2)(M^2 -(m_1 - m_2)^2)}}{2M}


The three body decay in the center mass frame :math:`P=(M,0,0,0),q^\star=(m_{23},0,0,0)`,
The three body decay in the center of mass frame :math:`P=(M,0,0,0),q^\star=(m_{23},0,0,0)`,

.. math::
\mathrm{d} \Phi(P;p_1,p_2,p_3) =& \mathrm{d}\Phi(P;p_1,q) \mathrm{d}\Phi(q^\star;p_2^\star,p_3^\star) \frac{\mathrm{d} q^2}{2\pi} \\
=& \frac{|\vec{p_1}||\vec{p_2^\star}|}{(2\pi)^5 16 M m_{23}} \mathrm{d} m_{23}^2 \mathrm{d} \Omega_1 \mathrm{d}\Omega_2^\star \\
=& \frac{|\vec{p_1}||\vec{p_2^\star}|}{(2\pi)^5 8 M} \mathrm{d} m_{23} \mathrm{d} \Omega_1 \mathrm{d}\Omega_2^\star

The n body decay in the center mass frame :math:`P=(M,0,0,0)`,
The N body decay in the center of mass frame :math:`P=(M,0,0,0)`,

.. math::
\mathrm{d} \Phi(P;p_1,\cdots,p_n) =& \mathrm{d}\Phi(P;p_1,q_1)\prod_{i=1}^{n-2} \frac{\mathrm{d} q_{i}^2}{2\pi}\mathrm{d}\Phi(q_{i},p_{i+1},p_{i+2})\\
Expand All @@ -75,7 +75,7 @@ with those limit
Phase Space Generator
---------------------

For n body phase space
For N body phase space

.. math::
\mathrm{d} \Phi(P;p_1,\cdots,p_n) =
Expand Down
Loading
Loading