graspfile.cut

This is the module for manipulating cut files containing one or more field cuts from TICRA Tools, GRASP and CHAMP

Classes

GraspCut() Class for reading, holding, manipulating and writing GRASP 9.3 format output cut files.
GraspCutSet() Class for containing a set of cuts with a common parameter, such as frequency, beam, etc.
GraspSingleCut() Class for reading, holding, manipulating and writing GRASP 9.3 format output cuts.
class graspfile.cut.GraspCut[source]

Bases: object

Class for reading, holding, manipulating and writing GRASP 9.3 format output cut files.

A file may contain multiple sets of cuts (e.g. at different frequencies), with each set having several cuts with varying constant coordinate value (e.g. phi in a theta-phi grid).

It’s common for GRASP cut files to not contain information on the distinguishing parameter between cut sets, particular for cut file output from CHAMP calculations. The user will have to supply this information, by e.g. creating a .frequencies list as an attributes to this object that stores the necessary information.

constants = None

A list of the constant values for each cut in each of the sets of cuts.

Type:list
cut_sets = None

List of GraspCutSet, each representing a set of cuts within the file

Type:list
cut_type = None

Describes the type of cut represented in the file. Options are:

  • spherical: a cut defined on the surface of a sphere
  • planar: a cut defined on a planar surface or the surface of a reflector
  • cylindrical: a cut defined on the surface of a cylinder
Type:str
read(fi)[source]

Read the contents from filelike fi and parse into cut objects

select_pos_range(pos_min, pos_max)[source]

Return a new cut file object containing only the parts of each cut between pos_min and pos_max inclusive

class graspfile.cut.GraspCutSet[source]

Bases: object

Class for containing a set of cuts with a common parameter, such as frequency, beam, etc.

cuts = None

List of GraspCut objects in the set.

Type:list
class graspfile.cut.GraspSingleCut[source]

Bases: object

Class for reading, holding, manipulating and writing GRASP 9.3 format output cuts.

constant = None

Constant variable for cut. GRASP Parameter C

definition determined by ICUT.

Type:float
cut_type = None

Cut type. Describes the type of cut. No GRASP equivalent

Values signify:
  • 1: Spherical cut
  • 2: Planar or surface cut
  • 3: Cylindrical cut
Type:int
data = None

Cut Data as complex array of field components.

Shape of array is (v_num, field_components)

Type:numpy.ndarray
field_components = None

Number of field components GRASP Parameter NCOMP

Value signifies:
  • 2: for far field
  • 3: for near field. 3rd component is always E_z
Type:int
icut = None

Cut definition. GRASP Parameter ICUT

Values signify the following cut definitions:
For spherical cuts:
  • 1: Standard polar cut with fixed phi
  • 2: Conical cut with fixed theta
For planar and surface cut
  • 1: Radial cut with fixed phi and variable distance rho
  • 2: Circular cut at fixed rho and variable phi
For cylindrical cut
  • 1: axial cut with fixed phi and variable z
  • 2: circular cut with fixed z and variable phi
Type:int
polarization = None

Polarization definition for the cut. GRASP Parameter ICOMP

Values signify the following polarization definitions
  • 1: Linear E_theta and E_phi.
  • 2: Right hand and left hand circular (Erhc and Elhc).
  • 3: Linear Eco and Ecx (Ludwig’s third definition).
  • 4: Linear along major and minor axes of the polarisation ellipse, Emaj and Emin.
  • 5: XPD fields: E_theta/E_phi and E_phi/E_theta.
  • 6: XPD fields: Erhc/Elhc and Elhc/Erhc.
  • 7: XPD fields: Eco/Ecx and Ecx/Eco.
  • 8: XPD fields: Emaj/Emin and Emin/Emaj.
  • 9: Total power |E| and Erhc=Elhc.
Type:int
positions

the positions of the data points in the cut file

Type:numpy.array
read(lines)[source]

Read cut from lines of text and parse as a cut, filing the parameters and data

select_pos_range(pos_min, pos_max)[source]

Returns a cut containing only the positions between pos_min and pos_max inclusive

text = None

Cut description.

Type:str
v_inc = None

Increment of variable that cut is swept over. GRASP Parameter V_INI

Type:float
v_ini = None

Initial value of variable that cut is swept over. GRASP Parameter V_INI

Type:float
v_num = None

Number of steps for variable that cut is swept over. GRASP Parameter V_NUM

Type:int
write()[source]

Write local arrays to disk in GRASP cut file format