Adaptive dual control of deep brain stimulation in Parkinsons disease simulations (Grado et al 2018)

 Download zip file 
Help downloading and running models
Accession:247310

Reference:
1 . Grado LL, Johnson MD, Netoff TI (2018) Bayesian adaptive dual control of deep brain stimulation in a computational model of Parkinson's disease. PLoS Comput Biol 14:e1006606 [PubMed]
Citations  Citation Browser
Model Information (Click on a link to find other models with that property)
Model Type: Neural mass;
Brain Region(s)/Organism:
Cell Type(s):
Channel(s):
Gap Junctions:
Receptor(s):
Gene(s):
Transmitter(s):
Simulation Environment: Python;
Model Concept(s): Parkinson's;
Implementer(s):
import time
import datetime
import os

class progbar(object):
    '''
    Command line progress bar.

    Parameters
    ----------
    marker : str, optional
        Progress bar marker

    Returns
    -------
    out : progbar

    Examples
    --------
    >>> from nrtlbox.utils import progbar
    >>>
    >>> pg = progbar()
    >>> for i in range(1000):
    ...     time.sleep(0.1) 
    ...     pg.update()
    ...
    '''
    def __init__(self, bar_len = 50, marker='='): 
        self.start_time = time.time()
        self.marker = marker
        self.bar_len = bar_len
        
    def update(self,pct):
        '''
        Updates and displays the progress bar

        Parameters
        ----------
        pct : float, [0,1]
            Fraction completed.
        '''

        if pct > 1: pct = 1
        if pct <= 0: pct = 1e-10
        
        elapsed = time.time() - self.start_time
        remaining = elapsed/pct - elapsed
        elapsed = str(datetime.timedelta(seconds = elapsed))
        remaining = str(datetime.timedelta(seconds = remaining))
        
        pre = '\r{:>6.2f}% {:.7s} ['.format(pct*100,elapsed)
        pre = '\r {:.7s} ['.format(elapsed)
        post = '] {:.7s} '.format(remaining)
        pct_str = ' {:>6.2f} % '.format(pct*100)

        bar = int(self.bar_len * pct) * self.marker + (self.bar_len - int(self.bar_len * pct)) * ' '

        pct_spot = int((self.bar_len - len(pct_str)) / 2)

        bar = bar[:pct_spot] + pct_str + bar[pct_spot+10:]
        
        out = pre+bar+post

        print(out,end='')