From ec5a633395ae0963473751c268237a9e5f713978 Mon Sep 17 00:00:00 2001 From: peter-janderks Date: Fri, 19 Jan 2024 10:19:57 +0100 Subject: [PATCH] add docstring to sinter bposd decoder --- .../sinter_decoders/sinter_bposd_decoder.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src_python/ldpc/sinter_decoders/sinter_bposd_decoder.py b/src_python/ldpc/sinter_decoders/sinter_bposd_decoder.py index e9cdde2..de6684f 100644 --- a/src_python/ldpc/sinter_decoders/sinter_bposd_decoder.py +++ b/src_python/ldpc/sinter_decoders/sinter_bposd_decoder.py @@ -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,