-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipycool.py
102 lines (85 loc) · 2.19 KB
/
ipycool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -*- coding: utf-8 -*-
from icoolinput import *
"""Nomenclature:
An ICOOL input file consists of:
1. Problem title
2. General control variables
3. Beam generation variables
4. Physics interactions control variables
5. Histogram definition variables
6. Scatterplot definition variables
7. Z-history definition variables
8. R-history definition variables
9. Emittance plane definition variables
10. Covariance plane definition variables
11. Region definition variables.
** Note that region definition variables are referred to in the ICOOL Manual and
herein as commands.
This program will use of following object definitions:
Namelists. Namelists in the for001.dat file are preceded by an '&'
sign (e.g., &cont).
Namelists include:
CONT: Control Variables
BMT: Beam Generation Variables
INTS: Phyiscs Interactions Control Variables
NHS: Histogram Definition Variables
NSC: Scatterplot definition Variables
NZH: Z-History Definition Variables
NRH: R-History Definition Variables
NEM: Emittance Plane Definition Variables
NCV: Covariance Plane Definition Variables
Namelist variables:
Each of the above namelists is associated with a respective set of variables.
Commands:
Commands comprise both Regular Region Commands and Pseudoregion Commands
Regular Region Commands:
SECTION
BEGS
REPEAT
CELL
SREGION
ENDREPEAT
ENDCELL
ENDSECTION
Psuedoregion Commands:
APERTURE
CUTV
DENP
DENS
DISP
DUMMY
DVAR
EDGE
GRID
OUTPUT
RESET
RKICK
ROTATE
TAPER
TILT
TRANSPORT
BACKGROUND
BFIELD
ENDB
!
&
Command parameters:
Each regular and pseduoregion command is respectively associated with a set of command parameters.
"""
from IPython.core.magic_arguments import (argument, magic_arguments,
parse_argstring)
from IPython.core.magic import (register_line_magic, register_cell_magic,
register_line_cell_magic)
#@register_line_magic
@magic_arguments()
@argument('-o', '--option', help='An optional argument.')
@argument('arg', type=int, help='An integer positional argument.')
def ipycool(self, arg):
""" A really cool ipycool magic command.
"""
args = parse_argstring(ipycool, arg)
@magic_arguments()
@register_line_magic
def icool():
"ICOOL"
exec('!icool')