Skip to content

Commit

Permalink
Merge pull request #489 from sandialabs/bugfix-guard-signal
Browse files Browse the repository at this point in the history
Bugfix guard signal
  • Loading branch information
sserita authored Sep 19, 2024
2 parents 911118c + db5f4b4 commit c1f97f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ doc/build
*gst_checkpoints*
*model_test_checkpoints*
*standard_gst_checkpoints*
*ibmqexperiment_checkpoint*

# Serialization Testing Artifacts #
###################################
Expand All @@ -43,6 +44,7 @@ test/output/pylint/*
test/output/individual_coverage/*/*
test/test_packages/cmp_chk_files/Fake_Dataset_none.txt.cache
**.noseids
**test_ibmq**

# Tutorial Notebook Untracked Files #
####################################
Expand Down
2 changes: 1 addition & 1 deletion pygsti/circuits/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3447,7 +3447,7 @@ def num_gates(self):
"""
if self._static:
def cnt(lbl): # obj a Label, perhaps compound
if lbl.is_simple(): # a simple label
if lbl.IS_SIMPLE: # a simple label
return 1 if (lbl.sslbls is not None) else 0
else:
return sum([cnt(sublbl) for sublbl in lbl.components])
Expand Down
6 changes: 5 additions & 1 deletion pygsti/optimize/customlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# http://www.apache.org/licenses/LICENSE-2.0 or in the LICENSE file in the root pyGSTi directory.
#***************************************************************************************************

import os as _os
import signal as _signal
import time as _time

Expand All @@ -25,7 +26,10 @@
# from scipy.optimize import OptimizeResult as _optResult

#Make sure SIGINT will generate a KeyboardInterrupt (even if we're launched in the background)
_signal.signal(_signal.SIGINT, _signal.default_int_handler)
#This may be problematic for multithreaded parallelism above pyGSTi, e.g. Dask,
#so this can be turned off by setting the PYGSTI_NO_CUSTOMLM_SIGINT environment variable
if 'PYGSTI_NO_CUSTOMLM_SIGINT' not in _os.environ:
_signal.signal(_signal.SIGINT, _signal.default_int_handler)

#constants
_MACH_PRECISION = 1e-12
Expand Down

0 comments on commit c1f97f8

Please sign in to comment.