Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

kenv

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kenv - pypi Package Compare versions

Comparing version
0.3.0.2
to
0.3.0.3
+21
kenv-0.3.0.3.dist-info/LICENSE
MIT License
Copyright (c) 2019 fuodorov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Metadata-Version: 2.1
Name: kenv
Version: 0.3.0.3
Summary: Kapchinscky ENVelope (KENV) - solver of the Kapchinsky-Vladimirsky envelope equation
Home-page: https://github.com/fuodorov/kenv
Author: Vyacheslav Fedorov
Author-email: fuodorov1998@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
# Kapchinsky ENVelope (KENV)
[![PyPI version](https://badge.fury.io/py/kenv.svg)](https://badge.fury.io/py/kenv)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fuodorov/kenv/master?filepath=notebooks%2Fintroduction.ipynb)
## The solver of Kapchinsky-Vladimirsky envelope equation for electron beam with space charge.
<a href=mailto:fuodorov1998@gmail.com>V. Fedorov</a>, <a href=mailto:nikdanila@bk.ru>D. Nikiforov</a>, <a href=http://www.inp.nsk.su/~petrenko/>A. Petrenko</a>, (Novosibirsk, 2019)
## Overview
KENV is a solver code for the equation of the envelope of an electron beam with the Kapchinsky-Vladimirsky distribution for accelerator physics.
It is particularly suitable for accelerating an electron beam in direct channels with solenoidal and quadrupole focusing.
In order to use the KENV code correctly, it is **important to read the [Doc](https://fuodorov.github.io/kenv/).**
## Algorithm
The algorithm reduces to lowering the order of the Kapchinsky-Vladimirsky differential equations to the first and subsequent integration.
## Language
KENV completely written in Python.
## Installation
In order to quickly install all the required [Python](https://www.python.org/downloads/) libraries in the new environment, just download [requirements](https://github.com/fuodorov/kenv/blob/master/requirements.txt) and run the command on the command line:
```
pip install -r requirements.txt
```
## Publications
[Publication](http://www1.jinr.ru/Pepan_letters/panl_2020_2/13_nikifor.pdf) in Particles and Nuclei.
kenv/__init__.py,sha256=TaAm10kt0pl5OkpMd2aDjDWZzV_CpghXgMWFxWPN6G0,316
kenv/accelerator.py,sha256=ol2zGs7wVqpOuTZRvMIiksWiu5WRJikPTTZrHRHtLUg,21270
kenv/beam.py,sha256=SYBSM4CQdd8emhiKDpYo_-mscB-fCv9W-oNeiT4GzEM,6163
kenv/constants.py,sha256=B8w8kM1Iq_mZta-WotUJLISUyqJbxdLRxhFWdjcioDY,276
kenv/solver.py,sha256=BjgaMEmuDDTma9A4wWlq45teZSipX3Nkv6_12CjtMUw,17420
kenv-0.3.0.3.dist-info/LICENSE,sha256=IJI7uaJvnqcOYDc8UYVfAiBDEIoU_RbwOBp9Qr72s-8,1065
kenv-0.3.0.3.dist-info/METADATA,sha256=C1BjrB33N2HIBihG_gSydLOr7wEyPggEbHe1_cm73HA,2061
kenv-0.3.0.3.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
kenv-0.3.0.3.dist-info/top_level.txt,sha256=3orirap0LaZ5otcyEwFA4SHIksNGlGAp48Awtf2W5U8,5
kenv-0.3.0.3.dist-info/RECORD,,
Wheel-Version: 1.0
Generator: bdist_wheel (0.36.2)
Root-Is-Purelib: true
Tag: py3-none-any
+1
-1

@@ -6,3 +6,3 @@ from .constants import *

__version__ = '0.3.0.2'
__version__ = '0.3.0.3'
__doc__ = """Kapchinscky ENVelope (KENV) -

@@ -9,0 +9,0 @@ solver of the Kapchinsky-Vladimirsky envelope equation"""

@@ -38,9 +38,9 @@ import numpy as np

x: float, optional
Offset of the element along the x-axis
Offset of the element along the x-axis, [m]
xp: float, optional
Element rotation in the z-x plane
Element rotation in the z-x plane, [rad]
y: float, optional
Offset of the element along the y-axis
Offset of the element along the y-axis, [m]
yp: float, optional
Element rotation in the z-y plane
Element rotation in the z-y plane, [rad]
"""

@@ -341,7 +341,7 @@ self.z0 = z0

name: string
Solenoid's id,
Solenoid's id
center: float
Solenoid's center,
Solenoid's center
max_field: float
Solenoid's maximum field [T],
Solenoid's maximum field [T]
file_name: string

@@ -378,7 +378,7 @@ Experimental profile of the Bz field

name: string
Accel's id,
Accel's id
center: float
Accel's center,
Accel's center
max_field: float
Accel's maximum field [MV/m],
Accel's maximum field [MV/m]
file_name: string

@@ -410,7 +410,7 @@ Experimental profile of the Ez field

name: string
Quad's id,
Quad's id
center: float
Quad's center,
Quad's center
max_field: float
Quad's maximum field [T/m],
Quad's maximum field [T/m]
file_name: string

@@ -441,7 +441,7 @@ Experimental profile of the Gz field

name: string
Corrector's id,
Corrector's id
center: float
Corrector's center,
Corrector's center
max_field: float
Corrector's maximum field [T],
Corrector's maximum field [T]
file_name: string

@@ -472,7 +472,7 @@ Experimental profile of the By field

name: string
Corrector's id,
Corrector's id
center: float
Corrector's center,
Corrector's center
max_field: float
Corrector's maximum field [T],
Corrector's maximum field [T]
file_name: string

@@ -479,0 +479,0 @@ Experimental profile of the Bx field

@@ -8,3 +8,5 @@ import kenv.constants as consts

class Particle:
"""Creating an particle"""
"""
Creating a particle.
"""

@@ -18,2 +20,20 @@ def __init__(self, *,

larmor_angle: float = .0e0):
"""
Initialization of a particle.
Parameters
----------
x: float
Position of the x-axis, [m]
y: float
Position of the y-axis, [m]
xp: float
Angle of the x-axis, [rad]
yp: float
Angle of the y-axis, [rad]
energy: float
Energy, [MeV]
larmor_angle: float
Larmor angle, [rad]
"""
self.x = x

@@ -39,23 +59,5 @@ self.y = y

class Beam:
"""Creating an electron beam.
Creating a round electron beam with parameters:
current [A],
energy [MeV],
radius [m],
rp [rad],
normalized emittance [m*rad],
Creating an elliptical electron beam with parameters:
radius_x [m],
radius_y [m],
radius_xp [rad],
radius_yp [rad],
normalized_emittance_x [m*rad],
normalized_emittance_y [m*rad]
and with shifted centroid:
x [m], y [m], xp[rad], yp[rad], larmor_angle [rad]
"""
Creating an electron beam.
"""

@@ -80,3 +82,43 @@ def __init__(self, *,

charge: int = -1):
"""
Initialization of an electron beam.
Parameters
----------
current: float
Beam current, [A]
energy: float
Beam energy, [MeV]
radius: float
Beam radius, [m]
radius_x: float, optional
Elliptical beam radius along the x-axis, [m]
radius_y: float, optional
Elliptical beam radius along the y-axis, [m]
rp: float
Beam radius prime, [rad]
radius_xp: float, optional
Elliptical beam radius prime along the x-axis, [rad]
radius_yp: float, optional
Elliptical beam radius prime along the y-axis, [rad]
normalized_emittance: float
Beam normalized emittance, [m*rad]
normalized_emittance_x: float, optional
Elliptical beam normalized emittance along the x-axis, [m*rad]
normalized_emittance_y: float, optional
Elliptical beam normalized emittance along the y-axis, [m*rad]
x: float, optional
Offset of the centroid along the x-axis, [m]
xp: float, optional
Centroid rotation in the z-x plane, [rad]
y: float, optional
Offset of the centroid along the y-axis, [m]
yp: float, optional
Centroid rotation in the z-y plane, [rad]
larmor_angle: float, optional
Centroid larmor angle, [rad]
charge: int, optional
Particle charge (dev!)
"""
self.current = current

@@ -83,0 +125,0 @@ self.energy = energy

@@ -13,6 +13,20 @@ import kenv.constants as consts

class Equations:
"""Located derivative for further integration."""
"""
Located derivative for further integration.
"""
def __init__(self, beam, accelerator,
particle=Particle()):
"""
Initializes an Equations.
Parameters
----------
beam: an instance of :any:`Beam`
Beam data
accelerator: an instance of :any:`Accelerator`
Accelerator data
Particle: an instance of :any:`Particle`, optional
Particle data
"""
self.beam = beam

@@ -25,5 +39,12 @@ self.accelerator = accelerator

X: list) -> list:
"""Located derivative for further integration
Kapchinscky equation for envelope beam.
"""
Located derivative for further integration
Kapchinscky equation for envelope beam.
Parameters
----------
z: an instance of the `np.arange` class
Axis z
X: list
Initial conditions, [x0, xp0, y, yp0]
"""

@@ -66,5 +87,12 @@

X: list) -> list:
"""Located derivative for further integration
Kapchinscky equation for centroid trajectory.
"""
Located derivative for further integration
Kapchinscky equation for centroid trajectory.
Parameters
----------
z: an instance of the `np.arange` class
Axis z
X: list
Initial conditions, [x0, xp0, y, yp0, larmor_angle]
"""

@@ -125,5 +153,12 @@

X: list, envelope_x, envelope_y) -> list:
"""Located derivative for further integration
Kapchinscky equation for envelope beam.
"""
Located derivative for further integration
Kapchinscky equation for envelope beam.
Parameters
----------
z: an instance of the `np.arange` class
Axis z
X: list
Initial conditions, [x0, xp0, y, yp0, larmor_angle]
"""

@@ -163,3 +198,3 @@

if ((x * x + y * y > envelope_x(z)**2 + envelope_y(z)**2) and
(x != 0.0 and y != 0.0)):
(x != 0.0 and y != 0.0)):
dxdz = xp

@@ -197,12 +232,21 @@ dxpdz = 2 * P * \

class Simulation:
"""Simulation of the envelope beam in the accelerator.
"""
Simulation of the envelope beam, centroid and particle in the accelerator.
Basic parameters after track:
gamma,
envelope_x and envelope_y,
envelope_xp and envelope_yp,
centroid_x and centroid_y,
centroid_xp and centroid_yp,
larmor_angle
The `Simulation` class has several important attributes:
- `envelope_x`, a object which contains the envelope information
- `envelope_y`, a object which contains the envelope information
- `envelope_xp`, a object which contains the envelope information
- `envelope_yp`, a object which contains the envelope information
- `centroid_x`, a object which contains the centroid information
- `centroid_y`, a object which contains the centroid information
- `centroid_xp`, a object which contains the centroid information
- `centroid_yp`, a object which contains the centroid information
- `particle_x`, a object which contains the particle information
- `particle_y`, a object which contains the particle information
- `particle_xp`, a object which contains the particle information
- `particle_yp`, a object which contains the particle information
"""

@@ -214,3 +258,14 @@

particle=Particle()):
"""
Initializes a Simulation.
Parameters
----------
beam: an instance of :any:`Beam`
Beam data
accelerator: an instance of :any:`Accelerator`
Accelerator data
Particle: an instance of :any:`Particle`, optional
Particle data
"""
self.beam = beam

@@ -244,5 +299,17 @@ self.accelerator = accelerator

method: str = 'RK23'):
"""Tracking!"""
"""Tracking!
# initial conditions
Parameters
----------
particle: bool
Particle equations switch
centroid: bool
Centroid equations switch
envelope: bool
Envelope equations switch
rtol: float, optional
atol: float, optional
method: str, optional
"""
equations = Equations(self.beam, self.accelerator, self.particle)

@@ -249,0 +316,0 @@

MIT License
Copyright (c) 2019 fuodorov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Metadata-Version: 2.1
Name: kenv
Version: 0.3.0.2
Summary: Kapchinscky ENVelope (KENV) - solver of the Kapchinsky-Vladimirsky envelope equation
Home-page: https://github.com/fuodorov/kenv
Author: Vyacheslav Fedorov
Author-email: fuodorov1998@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
# Kapchinsky ENVelope (KENV)
[![PyPI version](https://badge.fury.io/py/kenv.svg)](https://badge.fury.io/py/kenv)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fuodorov/kenv/master?filepath=notebooks%2Fintroduction.ipynb)
## The solver of Kapchinsky-Vladimirsky envelope equation for electron beam with space charge.
<a href=mailto:fuodorov1998@gmail.com>V. Fedorov</a>, <a href=mailto:nikdanila@bk.ru>D. Nikiforov</a>, <a href=http://www.inp.nsk.su/~petrenko/>A. Petrenko</a>, (Novosibirsk, 2019)
## Overview
KENV is a solver code for the equation of the envelope of an electron beam with the Kapchinsky-Vladimirsky distribution for accelerator physics.
It is particularly suitable for accelerating an electron beam in direct channels with solenoidal and quadrupole focusing.
In order to use the KENV code correctly, it is **important to read the [Doc](https://fuodorov.github.io/kenv/).**
## Algorithm
The algorithm reduces to lowering the order of the Kapchinsky-Vladimirsky differential equations to the first and subsequent integration.
## Language
KENV completely written in Python.
## Installation
In order to quickly install all the required [Python](https://www.python.org/downloads/) libraries in the new environment, just download [requirements](https://github.com/fuodorov/kenv/blob/master/requirements.txt) and run the command on the command line:
```
pip install -r requirements.txt
```
## Publications
[Publication](http://www1.jinr.ru/Pepan_letters/panl_2020_2/13_nikifor.pdf) in Particles and Nuclei.
kenv/__init__.py,sha256=R9x1gCViqBGD3LFxZhyTs6cAymAyBR_5qckrcpAMz0c,316
kenv/accelerator.py,sha256=ElLZd9le6-YPbbHHJtdAiOv1ccA7AsBWCD2SaTmFKFo,21261
kenv/beam.py,sha256=xn2oPKTmO6hXU3Ax4EI00eU5DTNDHfExqrWtkfDaG90,4653
kenv/constants.py,sha256=B8w8kM1Iq_mZta-WotUJLISUyqJbxdLRxhFWdjcioDY,276
kenv/solver.py,sha256=MJONaXMFbbE1KVIZN-mPoom60nAQiH7W0rqgr0gp7Rw,15156
kenv-0.3.0.2.dist-info/LICENSE,sha256=IJI7uaJvnqcOYDc8UYVfAiBDEIoU_RbwOBp9Qr72s-8,1065
kenv-0.3.0.2.dist-info/METADATA,sha256=RCymfqITBcWJjM4GTSKeitKF6PI2KWhopjxgT-lOQPA,2061
kenv-0.3.0.2.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
kenv-0.3.0.2.dist-info/top_level.txt,sha256=3orirap0LaZ5otcyEwFA4SHIksNGlGAp48Awtf2W5U8,5
kenv-0.3.0.2.dist-info/RECORD,,
Wheel-Version: 1.0
Generator: bdist_wheel (0.36.2)
Root-Is-Purelib: true
Tag: py3-none-any