Uploaded image for project: 'The Virtual Brain'
  1. The Virtual Brain
  2. TVB-1678

Method truncated_white from noise.py ignores user defined seed to set the initial conditions

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2, 1.3
    • Fix Version/s: 1.3.1
    • Component/s: TVB-Simulator
    • Environment:
      TVB 1.3-6899 on the cluster

      Description

      I launched some PSEs using different matrices, but the rest of that parameters were the same, however the coupling strength was set to 0. The PSE plots should have been identical. They weren't.

      The guilty was the seed used for setting the initial conditions.

      The method truncated_white in noise.py is currently not using the seed set through the interface.
      This methods uses the function truncnorm from scipy. So far, it is not possible to use a RandomState object with certain scipy functions. So we cannot do self.random_stream.truncnorm .... as it is done with the functions used in 'coloured' and 'white'.

      Using RandomState objects is the advised way to create streams of random
      numbers. Scipy functions like truncnorm depend on numpy.random and the only way to set the seed to get identical results is by doing
      numpy.random.seed(my_seed) ... some python developers are against it but it's the way suggested in the scipy documentation ...

      A way to fix the problem then is adding the following line in 'truncated_white'

      1. This is basically getting the 'init_seed' of the corresponding random_stream

      numpy.random.seed(self.random_stream.get_state()[1][0])

      before calling scipy_stats.truncnorm

      The streams of random numbers used by the integrators are ok because they are not calling truncated_white.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                marmaduke.woodman Marmaduke Woodman
                Reporter:
                paula.sanz-leon Paula Sanz Leon
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Due:
                  Created:
                  Updated:
                  Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 2 hours Original Estimate - 2 hours
                    2h
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 2 hours, 15 minutes
                    2h 15m