Skip to content

Commit

Permalink
add docstring to sinter bposd decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-janderks committed Jan 19, 2024
1 parent dca3abc commit ec5a633
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src_python/ldpc/sinter_decoders/sinter_bposd_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,35 @@ def decode_via_files(
obs_predictions_b8_out_path: pathlib.Path,
tmp_dir: pathlib.Path,
) -> None:
"""Performs decoding by reading problems from, and writing solutions to, file paths.
Args:
num_shots: The number of times the circuit was sampled. The number of problems
to be solved.
num_dets: The number of detectors in the circuit. The number of detection event
bits in each shot.
num_obs: The number of observables in the circuit. The number of predicted bits
in each shot.
dem_path: The file path where the detector error model should be read from,
e.g. using `stim.DetectorErrorModel.from_file`. The error mechanisms
specified by the detector error model should be used to configure the
decoder.
dets_b8_in_path: The file path that detection event data should be read from.
Note that the file may be a named pipe instead of a fixed size object.
The detection events will be in b8 format (see
https://github.com/quantumlib/Stim/blob/main/doc/result_formats.md ). The
number of detection events per shot is available via the `num_dets`
argument or via the detector error model at `dem_path`.
obs_predictions_b8_out_path: The file path that decoder predictions must be
written to. The predictions must be written in b8 format (see
https://github.com/quantumlib/Stim/blob/main/doc/result_formats.md ). The
number of observables per shot is available via the `num_obs` argument or
via the detector error model at `dem_path`.
tmp_dir: Any temporary files generated by the decoder during its operation MUST
be put into this directory. The reason for this requirement is because
sinter is allowed to kill the decoding process without warning, without
giving it time to clean up any temporary objects. All cleanup should be done
via sinter deleting this directory after killing the decoder.
"""
self.dem = stim.DetectorErrorModel.from_file(dem_path)
self.matrices = detector_error_model_to_check_matrices(self.dem)
self.bposd = BpOsdDecoder(self.matrices.check_matrix,
Expand Down

0 comments on commit ec5a633

Please sign in to comment.