pyPENELOPE

util – Utilities for reading and writing GEO files

Inheritance diagram of penelopetools.api.input.pengeom.util

class penelopetools.api.input.pengeom.util.Keyword(name, termination='')

Bases: object

create_expline(value)

Creates a exponent line. This type of line is characterised by a keyword, a value express as an exponent (see _toexponent()) and a termination string. The keyword and the total length of the line is checked not to exceed their respective maximum size.

Parameters:
  • keyword – 8-character keyword
  • value (float) – value of the keyword
  • termination – termination of the line
create_line(text, override_comment=None)

Creates an input line from the specified keyword, text and comment. The white space between the items is automatically adjusted to fit the line size. The keyword and the total length of the line is checked not to exceed their respective maximum size.

Parameters:
  • keyword – 8-character keyword
  • text – value of the keyword
  • comment – comment associated with the line
find_multiple_lines(lines)

Finds all the lines starting with the expected keyword.

Parameters:
  • lines (list) – all the lines in the input file
  • expected_keyword (str) – keyword of the line of interest
Returns:

List of all the lines

Return type:

list

find_single_line(lines)

Finds the first line starting with this keyword. If no occurrence is not found, the exception KeywordNotFound is raised.

Parameters:
  • lines (list) – all the lines in the input file
  • expected_keyword (str) – keyword of the line of interest
Returns:

line

Return type:

str

name
termination
penelopetools.api.input.pengeom.util.extract_keyword(line)

Returns the keyword of the specified line.

Parameters:line (str) – a line from the input file
Return type:str
penelopetools.api.input.pengeom.util.extract_keyword_values_termination(line)

Extracts the keyword, the values and the termination of an input line. The values are returned as a list.

Parameters:line – input line
Returns:keyword, values, comment
penelopetools.api.input.pengeom.util.extract_values(line)

Returns the values inside the specified line.

Parameters:line (str) – a line from the input file
Return type:list