File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -616,6 +616,8 @@ class seeds(_Config):
616
616
"""Master random seed to initialize the Pseudorandom Number Generator (PRNG)"""
617
617
ants = None
618
618
"""Seed used for antsRegistration, antsAI, antsMotionCorr"""
619
+ numpy = None
620
+ """Seed used by NumPy"""
619
621
620
622
@classmethod
621
623
def init (cls ):
@@ -626,6 +628,7 @@ def init(cls):
626
628
random .seed (cls .master ) # initialize the PRNG
627
629
# functions to set program specific seeds
628
630
cls .ants = _set_ants_seed ()
631
+ cls .numpy = _set_numpy_seed ()
629
632
630
633
631
634
def _set_ants_seed ():
@@ -635,6 +638,15 @@ def _set_ants_seed():
635
638
return val
636
639
637
640
641
+ def _set_numpy_seed ():
642
+ """NumPy's random seed is independant from Python's `random` module"""
643
+ import numpy as np
644
+
645
+ val = random .randint (1 , 65536 )
646
+ np .random .seed (val )
647
+ return val
648
+
649
+
638
650
def from_dict (settings ):
639
651
"""Read settings from a flat dictionary."""
640
652
nipype .load (settings )
You can’t perform that action at this time.
0 commit comments