py4sci

Previous topic

find

Next topic

parameters

This Page

checkpoint

Note

Functions for opening, editing, and saving Langmuir checkpoint files.

Module author: Adam Gagorik <adam.gagorik@gmail.com>

class checkpoint.CheckPoint(handle=None)[source]

A class to open Langmuir checkpoint files.

Attribute Description
electrons list of int
holes list of int
traps list of int
defects list of int
trapPotentials list of float
fluxState list of int
randomState list of int
parameters Parameters
Parameters:handle (str) – filename or file object; Can be None.
classmethod from_grid(grid)[source]

Create checkpoint file from grid object.

classmethod from_image(image, *args, **kwargs)[source]

Create checkpoint from image file. You can also pass another checkpoint object, a dictionary, or key=value pairs. The parameters will be updated accordingly.

Parameters:image (str) – name of image file
load(handle)[source]

Load checkpoint from a file.

Parameters:handle (str) – filename or file object
>>> chk = lm.checkpoint.CheckPoint()
>>> chk.load('out.chk')
save(handle)[source]

Save checkpoint to a file.

Parameters:handle (str) – filename or file object
>>> chk = lm.checkpoint.CheckPoint()
>>> chk.save('sim.inp')
clear()[source]

Forget all stored information.

>>> chk = lm.checkpoint.CheckPoint()
>>> chk.clear()
reset(keep_elecs=False, keep_holes=False)[source]

Reset a simulation.

Parameters:
  • keep_elecs (bool) – do not delete electrons
  • keep_holes (bool) – do not delete holes
update(*args, **kwargs)[source]

Update parameters. You can pass other checkpoint objects, python dictionaries, or key=value pairs. Since Langmuir uses dots in parameter names, underscores are replaced by dots in they key=value pairs.

has_key(key)[source]

Check if key exists in parameters.

Returns:True if key found
Return type:bool
fix_traps()[source]

Check trap parameter validity.

>>> chk = lm.checkpoint.CheckPoint()
>>> chk.fix_traps()
checkpoint.load(handle)[source]

Load checkpoint file.

Parameters:handle (str) – filename or file object
Returns:checkpoint object
Return type:Checkpoint
>>> chk = lm.checkpoint.load('out.chk')
checkpoint.load_last(work, **kwargs)[source]

Load the last checkpoint file found in the working directory.

Parameters:work (str) – directory to look in
Returns:checkpoint object
Return type:Checkpoint
>>> chk = lm.checkpoint.load_last('/home/adam/simulations')
checkpoint.compare(chk1, chk2)[source]

Rigorously compare to checkpoint files.

Parameters:
  • chk1 (lm.checkpoint.CheckPoint) – checkpoint object 1
  • chk2 (lm.checkpoint.CheckPoint) – checkpoint object 1
Returns:

a dictionary of results

Return type:

collections.OrderedDict