From b9833c545e58b0e5c0365271ef873d944591f3a6 Mon Sep 17 00:00:00 2001 From: amishgog Date: Mon, 22 Jul 2024 11:34:12 +0200 Subject: [PATCH] Testing pre-commit --- docs/FAQ.rst | 28 ++++++++++++++-------------- docs/developer.rst | 20 +++++++++----------- docs/install.rst | 12 ++++++------ 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/docs/FAQ.rst b/docs/FAQ.rst index 0817bb7..bfc0093 100644 --- a/docs/FAQ.rst +++ b/docs/FAQ.rst @@ -3,7 +3,7 @@ FAQ ================= -1. Precission Loss +1. Precision Loss ^^^^^^^^^^^^^^^^^^ :: @@ -12,9 +12,9 @@ FAQ Check the jac value, -1.1 If all absulute value is small. it is acceptable because of the precision. +1.1 If all absulute values are small. it is acceptable because of the precision. -1.2 If some absolute 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 @@ -30,26 +30,26 @@ Check the jac value, 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 for 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. @@ -66,7 +66,7 @@ There is a script (scripts/check_nan.py) to check it. 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:: @@ -74,7 +74,7 @@ There is a script (scripts/check_nan.py) to check it. 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()) @@ -100,7 +100,7 @@ There is 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 special models require large memory (such as an interpolation model), try another model. @@ -134,7 +134,7 @@ 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 @@ -142,10 +142,10 @@ The decay chain should be complete. All the item in decay should decay from init :: - RuntimeError: not decay chain available, 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 available. +6.3.2 Check the information in *remove decay chain*, see the reason why those decays are not available. *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. diff --git a/docs/developer.rst b/docs/developer.rst index 52da6eb..39f7f28 100644 --- a/docs/developer.rst +++ b/docs/developer.rst @@ -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 to the normal installtion process, however two additonal steps are to be performed here. - -The first thing is writing tests, and testing your code. +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 thing is `pre-commit`. it is needed for developing. +The other thing is `pre-commit`. It is needed for development. 1. You can install `pre-commit` as @@ -29,7 +27,7 @@ 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: @@ -38,13 +36,13 @@ You can check if pre-commit is working well by running: 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 about the options. + For developers using an editor with a formatter, you should be careful about the options. The following are all commands needed: diff --git a/docs/install.rst b/docs/install.rst index 2436ccf..4d1cdc2 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -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, @@ -64,7 +64,7 @@ and then you can install packages in the conda environment source ./tfpwa/bin/activate -- 1.2.5 You can exit the environment by +- 1.2.5 You can exit the environment by .. code:: @@ -105,7 +105,7 @@ When using `virtualenv`, there is also simple way to install tensorflow2 3. Other dependencies --------------------- +--------------------- Other dependencies of TFPWA is simple. @@ -126,7 +126,7 @@ Get the packages using 3.2.1 other dependencies -In conda environment, go into the directory of `tf-pwa`, you can install the rest dependencies by +In conda environment, go into the directory of `tf-pwa`, you can install rest of the dependencies by .. code:: @@ -166,7 +166,7 @@ Using `-e`, so it can be updated by `git pull` directly. 4. (option) Other dependencies. -------------------------------- +-------------------------------- There are some optional packages, such as `uproot` for reading root file. @@ -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 :