pyPENELOPE

io – Input/Output for PENELOPE options

Inheritance diagram of penelopetools.api.input.penelope.io

class penelopetools.api.input.penelope.io.HTMLFile

Bases: penelopetools.api.input.penelope.io._FileHandler

Writes options to a HTML file.

write(file, options, header_level=1)
Parameters:file – a writable file-like object
class penelopetools.api.input.penelope.io.InputFile

Bases: penelopetools.api.input.penelope.io._FileHandler

Reads and writes options from/to an IN file.

The class variable _OPTION_INSTANCE specifies the class of the options to create when reading an IN file.

The class variable _ORDER specifies the order of the options in the IN file. It is a list of the attribute name of the options. Comments can be added as well.

ELECTROBEAM_TITLE = ' >>>>>>>> Electron beam definition.'
EMERGINGDIST_TITLE = ' >>>>>>>> Emerging particles. Energy and angular distributions.'
END_TITLE = 'END'
JOBPROP_TITLE = ' >>>>>>>> Job properties.'
MATERIALDATA_TITLE = ' >>>>>>>> Material data and simulation parameters.'
read(file)

Reads the IN file and returns an options.Options.

Parameters:file – a file-like object
write(file, options)

Writes the options to an IN file located at the specified filepath.

Parameters:
  • file – a writable file-like object
  • options – options to write
class penelopetools.api.input.penelope.io.XMLFile

Bases: penelopetools.api.input.penelope.io._FileHandler

Reads and writes options from/to a XML file.

The class variable _OPTION_INSTANCE specifies the class of the options to create when reading a XML file.

can_read(file)
read(file)

Reads the XML file and returns an options.Options.

Parameters:file – a file-like object
write(file, options)

Writes the options to a XML file located at the specified filepath.

Parameters:
  • file – a writable file-like object
  • options – options to write