11# optics_functions
22
3- [ ![ Cron Testing] ( https://github.com/pylhc/optics_functions/workflows/Cron%20Testing/badge.svg )] ( https://github.com/pylhc/optics_functions/actions?query=workflow%3A%22Cron+Testing%22 )
4- [ ![ Code Climate coverage] ( https://img.shields.io/codeclimate/coverage/pylhc/optics_functions.svg?style=popout )] ( https://codeclimate.com/github/pylhc/optics_functions )
5- [ ![ Code Climate maintainability (percentage)] ( https://img.shields.io/codeclimate/maintainability-percentage/pylhc/optics_functions.svg?style=popout )] ( https://codeclimate.com/github/pylhc/optics_functions )
3+ [ ![ Tests] ( https://github.com/pylhc/optics_functions/actions/workflows/coverage.yml/badge.svg?branch=master )] ( https://github.com/pylhc/optics_functions/actions/workflows/coverage.yml )
64[ ![ GitHub last commit] ( https://img.shields.io/github/last-commit/pylhc/optics_functions.svg?style=popout )] ( https://github.com/pylhc/optics_functions )
7- <!-- [](https://github.com/pylhc/optics_functions) -->
85[ ![ PyPI Version] ( https://img.shields.io/pypi/v/optics_functions?label=PyPI&logo=pypi )] ( https://pypi.org/project/optics_functions/ )
96[ ![ GitHub release] ( https://img.shields.io/github/v/release/pylhc/optics_functions?logo=github )] ( https://github.com/pylhc/optics_functions/ )
107[ ![ Conda-forge Version] ( https://img.shields.io/conda/vn/conda-forge/optics_functions?color=orange&logo=anaconda )] ( https://anaconda.org/conda-forge/optics_functions )
@@ -18,11 +15,13 @@ See the [API documentation](https://pylhc.github.io/optics_functions/) for detai
1815## Installing
1916
2017Installation is easily done via ` pip ` :
18+
2119``` bash
2220python -m pip install optics_functions
2321```
2422
2523One can also install in a ` conda ` environment via the ` conda-forge ` channel with:
24+
2625``` bash
2726conda install -c conda-forge optics_functions
2827```
@@ -32,7 +31,7 @@ conda install -c conda-forge optics_functions
3231> ** Warning:** In certain scenarios, e.g. in case of non-zero closed orbit, the ` RDT ` calculations can be unreliable for ** thick** lattices.
3332> Convert to a _ thin_ lattice by slicing the lattice to reduce the error of the analytical approximation.
3433
35- #### Coupling Example:
34+ ### Coupling Example
3635
3736``` python
3837import logging
@@ -52,7 +51,7 @@ df_twiss = tfs.read("twiss.tfs", index="NAME")
5251df_coupling = coupling_via_cmatrix(df_twiss)
5352
5453# Example:
55- # print(df_coupling)
54+ # print(df_coupling)
5655#
5756# F1001 F1010 ... C22 GAMMA
5857# NAME ...
@@ -75,7 +74,7 @@ df_dqmin = closest_tune_approach(
7574)
7675
7776# Example:
78- # print(df_dqmin)
77+ # print(df_dqmin)
7978#
8079# DELTAQMIN
8180# NAME
@@ -95,7 +94,7 @@ df_dqmin = closest_tune_approach(
9594# (...)
9695
9796# write out
98- # as the writer can only handle real data,
97+ # as the writer can only handle real data,
9998# you need to split the rdts into real and imaginary parts before writing
10099tfs.write(
101100 " coupling.tfs" ,
@@ -104,7 +103,7 @@ tfs.write(
104103)
105104```
106105
107- #### RDT Example:
106+ ### RDT Example
108107
109108``` python
110109import logging
@@ -123,7 +122,7 @@ df_twiss = tfs.read("twiss.tfs", index="NAME")
123122# generate all valid RDT names, here for RDTs of order 2
124123rdts = [jklm2str(* jklm) for jklm in generator(orders = [2 ])[2 ]]
125124
126- # check correct signs (i.e if beam==4), merge twiss and errors,
125+ # check correct signs (i.e if beam==4), merge twiss and errors,
127126# add empty K(S)L columns if needed
128127df_twiss = prepare_twiss_dataframe(df_twiss = df_twiss, df_errors = None , max_order = 5 )
129128
@@ -136,8 +135,8 @@ df_rdts = calculate_rdts(
136135 complex_columns = True , # complex output
137136)
138137
139- # Example:
140- # print(df_rdts)
138+ # Example:
139+ # print(df_rdts)
141140# F0002 ... F2000
142141# NAME ...
143142# IP3 2.673376-1.045712j ... -2.863617-0.789910j
@@ -156,7 +155,7 @@ df_rdts = calculate_rdts(
156155# (...)
157156
158157# write out
159- # as the writer can only handle real data, either set real = True above
158+ # as the writer can only handle real data, either set real = True above
160159# or split the rdts into real and imaginary parts before writing
161160tfs.write(
162161 " rdts.tfs" ,
@@ -165,7 +164,7 @@ tfs.write(
165164)
166165```
167166
168- #### Appending Example:
167+ ### Appending Example
169168
170169``` python
171170import logging
@@ -187,7 +186,7 @@ df_twiss[["F1001", "F1010"]] = coupling_via_cmatrix(df_twiss, output=['rdts'])
187186
188187# Example:
189188# print(df_twiss)
190- #
189+ #
191190# Headers:
192191# NAME: TWISS
193192# TYPE: TWISS
@@ -196,7 +195,7 @@ df_twiss[["F1001", "F1010"]] = coupling_via_cmatrix(df_twiss, output=['rdts'])
196195# ORIGIN: 5.05.02 Linux 64
197196# DATE: 01/02/21
198197# TIME: 19.58.08
199- #
198+ #
200199# KEYWORD S ... F1001 F1010
201200# NAME ...
202201# IP3 MARKER 0.0000 ... -0.000000+0.000004j -0.004026+0.003574j
@@ -211,14 +210,15 @@ df_twiss[["F1001", "F1010"]] = coupling_via_cmatrix(df_twiss, output=['rdts'])
211210# BPMW.4L3.B1 MONITOR 26636.4387 ... -0.000000+0.000004j -0.004831+0.002376j
212211# MCBWH.4L3.B1 HKICKER 26641.0332 ... -0.000000+0.000004j -0.004691+0.002641j
213212```
214- ### Modules
213+
214+ ## Modules
215215
216216- ` coupling ` - Functions to estimate coupling from twiss dataframes and
217217 different methods to calculate the closest tune approach from
218218 the calculated coupling RDTs.
219219 ([ ** coupling.py** ] ( optics_functions/coupling.py ) , [ ** doc** ] ( https://pylhc.github.io/optics_functions/modules/coupling.html ) )
220220- ` rdt ` - Functions for the calculations of Resonance Driving Terms, as well as
221- getting lists of valid driving term indices for certain orders.
221+ getting lists of valid driving term indices for certain orders.
222222 ([ ** rdt.py** ] ( optics_functions/rdt.py ) , [ ** doc** ] ( https://pylhc.github.io/optics_functions/modules/rdt.html ) )
223223- ` utils ` - Helper functions to prepare the twiss dataframes for use with the optics
224224 functions as well as reusable utilities,
0 commit comments