Python time step

43 Python code examples are found related to " time step". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: dm_control_wrapper.py    From agents with Apache License 2.0 6 votes vote down vote up
def convert_time_step(time_step):
  """Convert to agents time_step type as the __hash__ method is different."""
  reward = time_step.reward
  if reward is None:
    reward = 0.0
  discount = time_step.discount
  if discount is None:
    discount = 1.0

  observation = tf.nest.map_structure(_maybe_float32, time_step.observation)
  return ts.TimeStep(
      ts.StepType(time_step.step_type),
      _as_float32_array(reward),
      _as_float32_array(discount),
      observation,
  ) 
Example 2
Source File: common.py    From tf2-mobile-pose-estimation with Apache License 2.0 6 votes vote down vote up
def get_time_and_step_interval(current_step, is_init=None):
    global before_step_and_time
    _current_step = current_step

    if is_init:
        before_step_and_time = (_current_step, datetime.datetime.now())
        return

    _before_step, _before_time = before_step_and_time
    _current_time = datetime.datetime.now()
    before_step_and_time = (_current_step, _current_time)

    _step_interval = _current_step - _before_step
    _elapsed_time_interval = _current_time - _before_time

    _time_interval_str = get_time_to_str(_elapsed_time_interval.total_seconds())
    _time_interval_per_step_str = get_time_to_str(_elapsed_time_interval.total_seconds() / float(_step_interval))

    return _time_interval_str, _time_interval_per_step_str 
Example 3
Source File: minitaur_gym_env.py    From soccer-matlab with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def set_time_step(self, control_step, simulation_step=0.001):
    """Sets the time step of the environment.

    Args:
      control_step: The time period (in seconds) between two adjacent control
        actions are applied.
      simulation_step: The simulation time step in PyBullet. By default, the
        simulation step is 0.001s, which is a good trade-off between simulation
        speed and accuracy.
    Raises:
      ValueError: If the control step is smaller than the simulation step.
    """
    if control_step < simulation_step:
      raise ValueError(
          "Control step should be larger than or equal to simulation step.")
    self.control_time_step = control_step
    self._time_step = simulation_step
    self._action_repeat = int(round(control_step / simulation_step))
    self._num_bullet_solver_iterations = (
        NUM_SIMULATION_ITERATION_STEPS / self._action_repeat)
    self._pybullet_client.setPhysicsEngineParameter(
        numSolverIterations=self._num_bullet_solver_iterations)
    self._pybullet_client.setTimeStep(self._time_step)
    self.minitaur.SetTimeSteps(
        action_repeat=self._action_repeat, simulation_step=self._time_step) 
Example 4
Source File: xml.py    From PVGeo with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def get_reader_time_step_values(extensions, reader_description):
    """Get the XML content for reader time step values the Python path when
    making a ParaView plugin.
    """
    return '''<DoubleVectorProperty
      name="TimestepValues"
      repeatable="1"
      information_only="1">
      <TimeStepsInformationHelper/>
          <Documentation>
          Available timestep values.
          </Documentation>
      </DoubleVectorProperty>
      <Hints>
          <ReaderFactory extensions="%s"
                  file_description="%s" />
      </Hints>
      ''' % (extensions, reader_description) 
Example 5
Source File: utils.py    From agents with Apache License 2.0 6 votes vote down vote up
def get_average_step_time(self, warmup=True):
    """Returns average step time (seconds) so far.

    Args:
      warmup: If true ignore first set of steps executed as determined by
        `log_steps`.

    Returns:
      Average step time in seconds.

    """
    if warmup:
      if len(self.timestamp_log) < 3:
        return -1
      elapsed = self.timestamp_log[-1].timestamp - self.timestamp_log[
          1].timestamp
      return elapsed / (self.log_steps * (len(self.timestamp_log) - 2))
    else:
      if len(self.timestamp_log) < 2:
        return -1
      elapsed = self.timestamp_log[-1].timestamp - self.timestamp_log[
          0].timestamp
      return elapsed / (self.log_steps * (len(self.timestamp_log) - 1)) 
Example 6
Source File: rex_gym_env.py    From rex-gym with Apache License 2.0 6 votes vote down vote up
def set_time_step(self, control_step, simulation_step=0.001):
        """Sets the time step of the environment.

        Args:
          control_step: The time period (in seconds) between two adjacent control
            actions are applied.
          simulation_step: The simulation time step in PyBullet. By default, the
            simulation step is 0.001s, which is a good trade-off between simulation
            speed and accuracy.
        Raises:
          ValueError: If the control step is smaller than the simulation step.
        """
        if control_step < simulation_step:
            raise ValueError("Control step should be larger than or equal to simulation step.")
        self.control_time_step = control_step
        self._time_step = simulation_step
        self._action_repeat = int(round(control_step / simulation_step))
        self._num_bullet_solver_iterations = (NUM_SIMULATION_ITERATION_STEPS / self._action_repeat)
        self._pybullet_client.setPhysicsEngineParameter(
            numSolverIterations=self._num_bullet_solver_iterations)
        self._pybullet_client.setTimeStep(self._time_step)
        self.rex.SetTimeSteps(action_repeat=self._action_repeat, simulation_step=self._time_step) 
Example 7
Source File: make_vizualization_json.py    From news-popularity-prediction with Apache License 2.0 6 votes vote down vote up
def make_time_step_json(lifetime,
                        comment_tree,
                        user_graph,
                        timestamp,
                        handcrafted_df_row):
    time_step_json = dict()

    # time_step_json["lifetime_seconds"] = get_human_readable_lifetime(lifetime)
    time_step_json["lifetime_seconds"] = lifetime
    # time_step_json["lifetime_date"] = get_date(timestamp)
    # time_step_json["timestamp"] = timestamp

    time_step_json["comment_tree"] = make_graph_json(comment_tree)
    time_step_json["user_graph"] = make_graph_json(user_graph)

    # time_step_json["comment_tree_node_list"] = get_graph_node_list(comment_tree)
    time_step_json["user_graph_node_list"] = get_graph_node_list(user_graph)

    # time_step_json["comment_tree_size"] = len(time_step_json["comment_tree_node_list"])
    # time_step_json["user_graph_size"] = len(time_step_json["user_graph_node_list"])

    time_step_json["features"] = make_features_json(handcrafted_df_row)

    return time_step_json 
Example 8
Source File: random_tf_policy_test.py    From agents with Apache License 2.0 5 votes vote down vote up
def create_time_step(self):
    observation = tf.constant([[1, 2], [3, 4]], dtype=tf.float32)
    time_step = ts.restart(observation)

    observation_spec = tensor_spec.TensorSpec(observation.shape.as_list(),
                                              tf.float32)
    time_step_spec = ts.time_step_spec(observation_spec)

    return time_step_spec, time_step 
Example 9
Source File: gait.py    From sensormotion with MIT License 5 votes vote down vote up
def step_time(peak_times):
    """
    Calculate step timing information.

    Step timing can be calculated from the peak times of the original
    acceleration signal. This includes mean time between steps,
    standard deviation of step time, and the coefficient of
    variation (sd/mean).

    Parameters
    ----------
    peak_times : ndarray
        Times of the peaks detected by :func:`sensormotion.peak.find_peaks`.

    Returns
    -------
    step_time_mean : float
        Mean time between all steps/peaks in the signal.
    step_time_sd : float
        Standard deviation of the distribution of step times in the signal.
    step_time_cov : float
        Coefficient of variation. Calculated as sd/mean.
    """

    peak_time_differences = np.diff(peak_times)
    peak_time_mean = np.mean(peak_time_differences)
    peak_time_sd = np.std(peak_time_differences)
    peak_time_cov = peak_time_sd / peak_time_mean

    return peak_time_mean, peak_time_sd, peak_time_cov 
Example 10
Source File: play_ground.py    From SocialRobot with Apache License 2.0 5 votes vote down vote up
def get_step_time(self):
        """
        Args:
            None
        Returns:
            The time span of an environment step
        """
        return self._step_time 
Example 11
Source File: bmi.py    From PCR-GLOBWB_model with GNU General Public License v3.0 5 votes vote down vote up
def get_time_step(self):
        """
        Return value:
        double: duration of one time step of the model in the units returned by the function get_time_units.
        """
        raise NotImplementedError 
Example 12
Source File: ibmqjob.py    From qiskit-ibmq-provider with Apache License 2.0 5 votes vote down vote up
def time_per_step(self) -> Optional[Dict]:
        """Return the date and time information on each step of the job processing.

        The output dictionary contains the date and time information on each
        step of the job processing, in local time. The keys of the dictionary
        are the names of the steps, and the values are the date and time data,
        as a datetime object with local timezone info.
        For example::

            {'CREATING': datetime(2020, 2, 13, 15, 19, 25, 717000, tzinfo=tzlocal(),
             'CREATED': datetime(2020, 2, 13, 15, 19, 26, 467000, tzinfo=tzlocal(),
             'VALIDATING': datetime(2020, 2, 13, 15, 19, 26, 527000, tzinfo=tzlocal()}

        Returns:
            Date and time information on job processing steps, in local time,
            or ``None`` if the information is not yet available.
        """
        if not self._time_per_step or self._status not in JOB_FINAL_STATES:
            self.refresh()

        # Note: By default, `None` should be returned if no time per step info is available.
        time_per_step_local = None
        if self._time_per_step:
            warnings.warn('The time per step date and time information is returned in '
                          'local time now, rather than UTC.', stacklevel=2)
            time_per_step_local = {}
            for step_name, time_data_utc in self._time_per_step.items():
                time_per_step_local[step_name] = utc_to_local(time_data_utc)

        return time_per_step_local 
Example 13
Source File: transforms.py    From spectral_connectivity with GNU General Public License v3.0 5 votes vote down vote up
def time_window_step(self):
        if self._time_window_step is None:
            self._time_window_step = (self.n_time_samples_per_step /
                                      self.sampling_frequency)
        return self._time_window_step 
Example 14
Source File: Simulation.py    From CS-1.1-Intro-to-Programming with MIT License 5 votes vote down vote up
def time_step(self, infected):
        ''' For every infected person interact with a random person from the population 10 times'''

        for infected_person in infected:

            for i in range(10):
                #TODO: get a random index for the population list
                #TODO: using the random index get a random person from the population
                #TODO: call interaction() with the current infected person and the random person
                pass 
Example 15
Source File: two_file_base.py    From PVGeo with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_time_step_values(self):
        """Use this in ParaView decorator to register timesteps.
        """
        # if unset, force at least one attempt to set the timesteps
        if self.__timesteps is None:
            self._update_time_steps()
        return self.__timesteps if self.__timesteps is not None else None 
Example 16
Source File: utils.py    From pylot with Apache License 2.0 5 votes vote down vote up
def set_asynchronous_fixed_time_step_mode(world, fps):
    settings = world.get_settings()
    settings.synchronous_mode = False
    settings.fixed_delta_seconds = 1.0 / fps
    world.apply_settings(settings) 
Example 17
Source File: envs.py    From Simulator with GNU General Public License v3.0 5 votes vote down vote up
def step_increase_city_time(self):
        self.city_time += 1
        # set city time of drivers
        for driver_id, driver in self.drivers.iteritems():
            driver.set_city_time(self.city_time) 
Example 18
Source File: stationary_stochastic_py_environment_test.py    From agents with Apache License 2.0 5 votes vote down vote up
def check_unbatched_time_step_spec(time_step, time_step_spec, batch_size):
  """Checks if time step conforms array spec, even if batched."""
  if batch_size is None:
    return array_spec.check_arrays_nest(time_step, time_step_spec)

  if not all([spec.shape[0] == batch_size for spec in time_step]):
    return False

  unbatched_time_step = ts.TimeStep(
      step_type=time_step.step_type[0],
      reward=time_step.reward[0],
      discount=time_step.discount[0],
      observation=time_step.observation[0])
  return array_spec.check_arrays_nest(unbatched_time_step, time_step_spec) 
Example 19
Source File: py_environment.py    From agents with Apache License 2.0 5 votes vote down vote up
def time_step_spec(self) -> ts.TimeStep:
    """Describes the `TimeStep` fields returned by `step()`.

    Override this method to define an environment that uses non-standard values
    for any of the items returned by `step()`. For example, an environment with
    array-valued rewards.

    Returns:
      A `TimeStep` namedtuple containing (possibly nested) `ArraySpec`s defining
      the step_type, reward, discount, and observation structure.
    """
    return ts.time_step_spec(self.observation_spec(), self.reward_spec()) 
Example 20
Source File: io.py    From FlowCal with MIT License 5 votes vote down vote up
def time_step(self):
        """
        Time step of the time channel.

        The time step is such that ``self[:,'Time']*time_step`` is in
        seconds. If no time step was found in the FCS file, `time_step` is
        None.

        """
        return self._time_step 
Example 21
Source File: dynamics.py    From DynaPhoPy with MIT License 5 votes vote down vote up
def get_time_step_average(self):

        if not self._time_step_average :
            self._time_step_average = 0
            for i in range(len(self.get_time()) - 1):
                self._time_step_average += (self.get_time()[i+1] - self.get_time()[i])/(len(self.get_time()) - 1)
   #         self._time_step_average /= (self.get_time().shape[0]-1)
        self._time_step_average = np.round(self._time_step_average, decimals=8)

        return self._time_step_average 
Example 22
Source File: BMI_base.py    From topoflow with MIT License 5 votes vote down vote up
def get_time_step(self):

        return np.float64( self.dt )
    
    #   get_time_step()
    #------------------------------------------------------------------- 
Example 23
Source File: utils.py    From fac-via-ppg with Apache License 2.0 5 votes vote down vote up
def get_mask_from_lengths_window_and_time_step(lengths, attention_window_size,
                                               time_step):
    """
    One for mask and 0 for not mask
    Args:
        lengths:
        attention_window_size:
        time_step: zero-indexed

    Returns:

    """
    # Mask all initially.
    max_len = torch.max(lengths).item()
    B = len(lengths)
    mask = torch.cuda.ByteTensor(B, max_len)
    mask[:] = 1

    for ii in range(B):
        # Note that the current code actually have a minor side effect,
        # where the utterances that are shorter than the longest one will
        # still have their actual last time step unmasked when the decoding
        # passes beyond that time step. I keep this bug here simply because
        # it will prevent numeric errors when computing the attention weights.
        max_idx = lengths[ii] - 1
        # >=0, <= the actual sequence end idx (length-1) (not covered here)
        start_idx = min([max([0, time_step-attention_window_size]), max_idx])
        # <=length-1
        end_idx = min([time_step+attention_window_size, max_idx])
        if start_idx > end_idx:
            continue
        mask[ii, start_idx:(end_idx+1)] = 0
    return mask 
Example 24
Source File: bmi_wrapper.py    From indra with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def get_time_step(self):
        """Return the time step associated with model simulation.

        Returns
        -------
        dt : float
            The time step for model simulation
        """
        return self.dt 
Example 25
Source File: __init__.py    From neat-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_max_time_step(self):  # pragma: no cover
        # TODO: Compute max time step that is known to be numerically stable for
        # the current network configuration.
        # pylint: disable=no-self-use
        raise NotImplementedError() 
Example 26
Source File: __init__.py    From neat-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_time_step_msec(self):
        # pylint: disable=no-self-use
        # TODO: Investigate performance or numerical stability issues that may
        # result from using this hard-coded time step.
        return 0.05 
Example 27
Source File: time_step.py    From tensor2tensor with Apache License 2.0 5 votes vote down vote up
def create_time_step(cls,
                       observation=None,
                       done=False,
                       raw_reward=None,
                       processed_reward=None,
                       action=None,
                       info=None):
    """Creates a TimeStep with both rewards and actions as optional."""

    return cls(observation, done, raw_reward, processed_reward, action,
               info) 
Example 28
Source File: trajectory.py    From tensor2tensor with Apache License 2.0 5 votes vote down vote up
def add_time_step(self, **create_time_step_kwargs):
    """Creates a time-step and appends it to the list.

    Args:
      **create_time_step_kwargs: Forwarded to
        time_step.TimeStep.create_time_step.
    """
    ts = time_step.TimeStep.create_time_step(**create_time_step_kwargs)
    assert isinstance(ts, time_step.TimeStep)
    self._time_steps.append(ts) 
Example 29
Source File: trajectory.py    From tensor2tensor with Apache License 2.0 5 votes vote down vote up
def change_last_time_step(self, **replace_time_step_kwargs):
    """Replace the last time-steps with the given kwargs."""

    # Pre-conditions: self._time_steps shouldn't be empty.
    assert self._time_steps
    self._time_steps[-1] = self._time_steps[-1].replace(
        **replace_time_step_kwargs) 
Example 30
Source File: __init__.py    From cadCAD with MIT License 5 votes vote down vote up
def time_step(dt_str, dt_format='%Y-%m-%d %H:%M:%S', _timedelta = tstep_delta):
    # print(dt_str)
    dt = datetime.strptime(dt_str, dt_format)
    t = dt + _timedelta
    return t.strftime(dt_format) 
Example 31
Source File: hdf5.py    From nata with MIT License 5 votes vote down vote up
def time_step(self):
        info(f"Accessing '{self.location}' for 'time_step'")
        with h5.File(self.location, mode="r") as fp:
            time = fp.attrs["TIME"][0]
        return time 
Example 32
Source File: demo_plotter.py    From momi2 with GNU General Public License v3.0 5 votes vote down vote up
def step_time(self, nxt_t, add=True):
        assert self.curr_t <= nxt_t
        self.curr_N = self.curr_N * np.exp(
            -self.curr_g * (nxt_t - self.curr_t))
        self.curr_t = nxt_t

        if add and self.active:
            self.points.append(PopulationPoint(
                self.curr_t, self.curr_N, self.curr_g, self.next_is_leaf))
            self.next_is_leaf = False 
Example 33
Source File: __init__.py    From armi with Apache License 2.0 5 votes vote down vote up
def getTimeStepNum(cycleNumber, subcycleNumber, cs):
    """Return the timestep associated with cycle and tn.

    Parameters
    ----------
    cycleNumber : int, The cycle number
    subcycleNumber : int, The intra-cycle time node (0 for BOC, etc.)
    cs : Settings object

    """
    return cycleNumber * getNodesPerCycle(cs) + subcycleNumber 
Example 34
Source File: __init__.py    From armi with Apache License 2.0 5 votes vote down vote up
def getPreviousTimeStep(cycle, node, burnSteps):
    """Return the time step before the specified time step"""
    if (cycle, node) == (0, 0):
        raise ValueError("There is not Time step before (0, 0)")
    if node != 0:
        return (cycle, node - 1)
    else:
        # index starts at zero, so the last node in a cycle is equal to the number of
        # burn steps.
        return (cycle - 1, burnSteps) 
Example 35
Source File: proposal.py    From cpnest with MIT License 5 votes vote down vote up
def update_time_step(self, acceptance):
        """
        Update the time step according to the
        acceptance rate
        Parameters
        ----------
        acceptance : :obj:'numpy.float'
        """
        diff = acceptance - self.TARGET
        new_log_scale = np.log(self.scale) + self.ADAPTATIONSIZE * diff
        self.scale = np.exp(new_log_scale)
        self.dt = self.base_dt * self.scale 
Example 36
Source File: cart_pole_ql_experiments.py    From modelicagym with GNU General Public License v3.0 5 votes vote down vote up
def time_step_experiment(tss):
    for ts in tss:
        run_experiment_with_result_files(folder,
                                         n_experiments=5,
                                         n_episodes=200,
                                         visualize=False,
                                         m_cart=10,
                                         m_pole=1,
                                         theta_0=85 / 180 * math.pi,
                                         theta_dot_0=0,
                                         time_step=ts,
                                         positive_reward=1,
                                         negative_reward=-100,
                                         force=15,
                                         log_level=logging.INFO) 
Example 37
Source File: SolverBase.py    From FenicsSolver with GNU Lesser General Public License v3.0 5 votes vote down vote up
def get_time_step(self, time_iter_):
        ## fixed step, but could be supplied with an np.array/list
        try:
            dt = float(self.transient_settings['time_step'])
        except:
            ts = self.transient_settings['time_series']
            if len(ts) >= time_iter_:
                dt = ts[time_iter_] - ts[time_iter_]
            else:
                print('time step can only be a sequence or scalar')
        #self.mesh.hmin()  # Compute minimum cell diameter. courant number
        return dt 
Example 38
Source File: synchronization.py    From scikit-dsp-comm with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def time_step(z,Ns,t_step,Nstep):
    """
    Create a one sample per symbol signal containing a phase rotation
    step Nsymb into the waveform.

    :param z: complex baseband signal after matched filter
    :param Ns: number of sample per symbol
    :param t_step: in samples relative to Ns
    :param Nstep: symbol sample location where the step turns on
    :return: the one sample per symbol signal containing the phase step

    Mark Wickert July 2014
    """
    z_step = np.hstack((z[:Ns*Nstep], z[(Ns*Nstep+t_step):], np.zeros(t_step)))
    return z_step 
Example 39
Source File: routing.py    From PCR-GLOBWB_model with GNU General Public License v3.0 5 votes vote down vote up
def estimate_length_of_sub_time_step(self): 

        # estimate the length of sub-time step (unit: s):
        # - the shorter is the better
        # - estimated based on the initial or latest sub-time step discharge (unit: m3/s)
        # 
        length_of_sub_time_step = pcr.ifthenelse(self.subDischarge > 0.0, 
                                  self.water_height * self.dynamicFracWat * self.cellArea / \
                                  self.subDischarge, vos.secondsPerDay())
        # TODO: Check this logic with Rens!                           

        # determine the number of sub time steps (based on Rens van Beek's method)
        #
        critical_condition = (length_of_sub_time_step < vos.secondsPerDay())  & \
                             (self.water_height > self.critical_water_height) & \
                             (self.lddMap != pcr.ldd(5))
        #
        number_of_sub_time_steps = vos.secondsPerDay() /\
                                   pcr.cover(
                                   pcr.areaminimum(\
                                   pcr.ifthen(critical_condition, \
                                              length_of_sub_time_step),self.landmask),\
                                             vos.secondsPerDay()/self.limit_num_of_sub_time_steps)   
        number_of_sub_time_steps = 1.25 * number_of_sub_time_steps + 1
        number_of_sub_time_steps = pcr.roundup(number_of_sub_time_steps)
        #
        number_of_loops = max(1.0, pcr.cellvalue(pcr.mapmaximum(number_of_sub_time_steps),1)[1])     # minimum number of sub_time_steps = 1 
        number_of_loops = int(max(self.limit_num_of_sub_time_steps, number_of_loops))
        
        # actual length of sub-time step (s)
        length_of_sub_time_step = vos.secondsPerDay() / number_of_loops

        return (length_of_sub_time_step, number_of_loops) 
Example 40
Source File: robustPipelineSizing.py    From FINE with MIT License 4 votes vote down vote up
def computeTimeStepFlows(injectionWithdrawalRates, distances, graph, entries, exits, threads=1, verbose=0, solver='glpk'):
    """"
    Compute for each timeStep and demands given by injectionWithdrawalRates the corresponding flow values

    :param: injectionWithdrawalRates: injection and withdrawal rates (withdrawals from the network are positive while
        injections are negative) in [kg^3/s]
    :type injectionWithdrawalRates: pandas DataFrame

    :param distances: pipeline distances in the length unit specified in the esM object ([m])
    :type distances: pandas series

    :param graph: an undirected networkx graph: Its edges have the attribute length which is the pipeline length in [m]
    :type graph: networkx graph object

    :param entries: list of entry nodes of the network
    :type entries: list of str

    :param exits: list of exit nodes of the network
    :type exits: list of str

    :param threads: number of threads used for parallelization
    :type threads: positive integer

    :param verbose: if > 0, parallelization progress is displayed
    :type verbose: int

    :param solver: name of the optimization solver to use
    :type solver: string, default 'glpk'

    :return: dictionary that contains for every time step the corresponding flows in [kg/s]
    :rtype: dictionary key: timeStep, value: dict: key: arc, value: arc flow
    """
    # Type and value check
    isPandasDataFrameNumber(injectionWithdrawalRates)
    isPandasSeriesPositiveNumber(distances)
    isNetworkxGraph(graph)
    isListOfStrings(entries)
    isListOfStrings(exits)

    # compute for every time step the corresponding flows; dict: key: timeStep, value: dict: key: arc, value: flow
    dic_timeStep_flows = {}
    # nodes with nonzero demand are given by columns of dataframe
    activeNodes = injectionWithdrawalRates.columns
    pool = Pool(threads)

    indexList = list(injectionWithdrawalRates.index)

    for i, values in enumerate(pool.imap(partial(_computeTimeStepFlows, graph=graph, distances=distances,
                                                entries=entries, exits=exits, startNode=activeNodes[0],
                                                endNode=activeNodes[1], specialScenario=False,
                                                injectionWithdrawalRates=injectionWithdrawalRates,
                                                solver=solver),
                               indexList), 1):
        if verbose == 0:
            sys.stderr.write('\rPercentage simulated: {:d}%'.format(int(i / len(indexList) * 100)))
        dic_timeStep_flows[values[0]] = values[1]
    pool.close()
    pool.join()

    return dic_timeStep_flows