Example #1
0
def acquisition(items, **kwargs):
    import emoji
    from prompt_toolkit import print_formatted_text
    from prompt_toolkit.patch_stdout import patch_stdout
    from prompt_toolkit.shortcuts.progress_bar import ProgressBar

    def progress(bar):
        acq = bar.data
        acq.start()
        for result in bar:
            result.Release()

    cameras, configs, opts, acqs = zip(*items)
    movie_camera = emoji.EMOJI_ALIAS_UNICODE[":movie_camera:"]
    title = f"{movie_camera} Acquiring on " + ", ".join(str(c) for c in cameras)
    pbar = ProgressBar(title=title)
    chrono = Chronometer()
    pool = concurrent.futures.ThreadPoolExecutor(max_workers=len(cameras))
    try:
        with contextlib.ExitStack() as stack:
            [stack.enter_context(camera) for camera in cameras]
            [stack.enter_context(acq) for acq in acqs]
            stack.enter_context(pbar)
            bars = [
                pbar(acq, label=f'{acq.camera}: ', total=acq.nb_frames)
                for acq in acqs
            ]
            stack.enter_context(chrono)
            for result in pool.map(progress, bars):
                pass
    finally:
        print_formatted_text(f"Elapsed time: {chrono.elapsed:.6f}s")
Example #2
0
def read_data(n=415):
    with Chronometer() as cr:
        k = 1
        imageDTOs = []
        with open("input/truth.txt", "r") as reader:
            length = int(reader.readline())
            if n < length:
                length = n
            for _ in range(length):
                n = reader.readline()
                n = n.split(",")
                m = int(n[1])
                n = int(n[0])
                matrix = []
                for line in range(n):
                    matrix_line = []
                    line = reader.readline()
                    line = line.split(",")
                    for j in range(m):
                        matrix_line.append(int(line[j]))
                    matrix.append(matrix_line)
                truth = reader.readline()
                truth = truth[:-1]
                imageDTOs.append(ImageDTO(matrix, truth))
                if k % 5 == 0:
                    print("#" + str(k))
                k += 1
    print('Reading done..\nElapsed time: {:.3f} seconds\nTotal length: {}'.
          format(float(cr), len(imageDTOs)))
    return imageDTOs
Example #3
0
def camera_acquisition(ctx, trigger, nb_frames, exposure, latency, roi, binning, pixel_format):
    """do an acquisition on the selected camera"""
    import emoji
    from prompt_toolkit import print_formatted_text
    from prompt_toolkit.patch_stdout import patch_stdout
    from prompt_toolkit.shortcuts.progress_bar import ProgressBar

    camera = ctx.obj["camera"]
    config = ctx.obj["config"]
    trigger = trigger.lower()
    config.trigger_source = trigger
    total_time = nb_frames * (exposure + latency)
    if roi is not None:
        roi = [int(i) for i in roi.split(",")]
        assert len(roi) == 4
    movie_camera = emoji.emojize(":movie_camera:")
    title = f"{movie_camera} Acquiring {nb_frames} frames"
    if nb_frames:
        total_time = nb_frames * (exposure + latency)
        title += f" (Total acq. time: {total_time:.3f}s)"

    acq = Acquisition(
        camera, nb_frames, exposure, latency,
        roi=roi, trigger=trigger, binning=binning, pixel_format=pixel_format
    )
    prog_bar = ProgressBar(title=title)
    chrono = Chronometer()
    try:
        with camera, acq, prog_bar:
            bar = prog_bar(label=f"{camera}: ", total=nb_frames)
            acq.start()
            with Chronometer() as chrono:
                frame_nb = 0
                while frame_nb < nb_frames or not nb_frames:
                    if trigger == "software":
                        pause(
                            "Press any key to trigger acquisition "
                            f"{frame_nb+1} of {nb_frames}... "
                        )
                    result = next(acq)
                    result.Release()
                    frame_nb += 1
                    bar.items_completed = frame_nb
                    prog_bar.invalidate()
    finally:
        print_formatted_text(f"Elapsed time: {chrono.elapsed:.6f}s")
Example #4
0
 def __init__(self, s, lmbda, mu, nq):
     self.lmbda = lmbda
     self.nq = nq
     self.n = nq
     self.mu = mu
     self.s = s
     self.ei = 0
     self.chronometer = Chronometer()
     self.queue = QueueTP(self.lmbda, self.nq, self.chronometer)
     self.servers = []
     # self.statistic = Statistics(lmbda, mu, s, nq, nq)
     for i in range(0, s):
         self.servers.append(Server(self.mu, self.queue, self.chronometer))
Example #5
0
 def sendFromOptions(self):
     with Chronometer() as t:
         self.conectar()  #se não tiver -g ou -n então dá erro!
         logging.warn('conectar() demorou {:.3f} seconds!'.format(float(t)))
         if self.getContatoBol:
             print(self.getContato())
             logging.warn(
                 'print( self.getContato() ) demorou {:.3f} seconds!'.
                 format(float(t)))
         if self.msg.c_name:
             self.enviarMensagem(c_name=self.msg.c_name,
                                 message=self.msg.message)
         self.lockScreen(False)
     logging.warn('sendFromOptions() demorou {:.3f} seconds!'.format(
         float(t)))
Example #6
0
def read_data_img(resize=-1):
    with Chronometer() as cr:
        mias = []
        ddsm = []
        # t = threading.Thread(target=read_mias_data, args=(mias, resize,))
        t2 = threading.Thread(target=read_ddsm_data, args=(
            ddsm,
            resize,
        ))
        t2.start()
        # t.start()
        # t.join()
        t2.join()
        imageDTOs = mias + ddsm
    print('Reading done..\nElapsed time: {:.3f} seconds\nTotal length: {}'.
          format(float(cr), len(imageDTOs)))
    write_data(imageDTOs)
    return imageDTOs
def test_integration():
    t = Chronometer()

    t.start()

    a = t.elapsed
    time.sleep(0.002)
    b = t.elapsed

    assert b > a

    t.stop()

    c = t.elapsed
    time.sleep(0.002)
    d = t.elapsed

    assert (d - c) < 0.000001
def hydrate(ids, path, filename):
    """
    Hydrate tweets in order to update the data
    """
    T = twarc.Twarc()
    last_t = 0
    with Chronometer() as t:
        count = 0
        hydrated_tweets = []

        for tweet in T.hydrate(iter(ids)):
            assert tweet['id_str']
            count += 1
            hydrated_tweets.append(tweet)
            if (int(float(t)) % 10 == 0 and int(float(t)) != last_t):
                print("Hydrated tweets:", len(hydrated_tweets))
                last_t = int(float(t))

        with jsonlines.open(path + filename, mode='w') as writer:
            for obj in hydrated_tweets:
                writer.write(obj)

    return count, hydrated_tweets
Example #9
0
def upload_users():
    """
    Uploads all the generated users profile to api/ucarpooling/users/
    """

    try:
        con = sqlite3.connect(settings.DATABASE)
        con.row_factory = sqlite3.Row

        cursorObj = con.cursor()

        """Building the query for retrieving all the users and their assigned profiles"""
        querystring = Query \
            .from_(Table(settings.DATABASE_TABLE_ALUMNI)) \
            .join(Table(settings.DATABASE_TABLE_ELOQUENCE)) \
            .on_field('uuid') \
            .join(Table(settings.DATABASE_TABLE_SMOKER)) \
            .on_field('uuid') \
            .join(Table(settings.DATABASE_TABLE_MUSIC)) \
            .on_field('uuid') \
            .select('*')\
            .limit(settings.LIMIT_USERS)

        """Executing the query"""
        rows = cursorObj.execute(querystring.get_sql()).fetchall()

        """Iteraring for each row in the database for alumni"""
        with Chronometer() as time_uploading:
            for alumni in rows:


                """Building the body in a json-like format for the boy of the POST request"""
                body = {
                    "email": f"{alumni[settings.FIELDNAME_UUID.lower()]}@mail.com",
                    "password": "******",
                    "first_name": str(alumni[settings.FIELDNAME_UUID.lower()]),
                    "last_name": str(alumni[settings.FIELDNAME_UUID.lower()]),
                    "ucarpoolingprofile": {
                        "sex": alumni[settings.FIELDNAME_SEX.lower()],
                        "smoker": True if alumni[settings.FIELDNAME_SMOKER.lower()] == 'Si' else False,
                        "musicTaste": alumni[settings.FIELDNAME_MUSIC_TASTE.lower()].split(", "),
                        "eloquenceLevel": get_eloquence_level(alumni[settings.FIELDNAME_ELOQUENCE.lower()])
                    }
                }

                "POST the alumni data to the API"
                response = requests.post(
                    url=settings.USER_URL,
                    json=body,
                    headers={
                        "Authorization": f'Token {settings.UCARPOOLING_APP_TOKEN}'  # Token of the Ucarpooling app
                    }
                )

                if response.status_code == 201:
                    helper.success_message(f'Uploaded successfully alumni {alumni[settings.FIELDNAME_UUID.lower()]}')

                    get_token(con, cursorObj, alumni)

                else:
                    helper.error_message(f'Error uploading alumni {alumni[settings.FIELDNAME_UUID.lower()]} '
                                         f'---- status code: {response.status_code}: {response.reason}')

            """Uploading ended"""
            helper.info_message('=================UPLOADING ENDED=====================')
            helper.detail_message('Uploading runtime: {:.3f} seconds'.format(float(time_uploading)))

    except Error:

        print(Error)

    finally:

        """Closing the database connection"""
        con.close()
from balanced_binary_search_tree import Tree
import random as rdn
from chronometer import Chronometer

if __name__ == "__main__":
    tree_control = Tree()

    with Chronometer() as time:
        i = 0
        count = 50

        #tree_control.insert_node([50,40,35,30,25,47,43,41,44,55,60,57,65])

        with Chronometer() as t:
            while i < count:
                info = rdn.randint(1,100)
                tree_control.insert_node(info)
                if i == count/2:
                    temp = info
                i = i + 1
        print('To insert spend {:.5f} seconds'.format(float(t)))

        with Chronometer() as t:
            print('\nin order: ', end='')
            tree_control.in_order()
        print('\n\nTo print spend {:.5f} seconds'.format(float(t)))

        print('\nTree Info: ')
        print('      root -> ', tree_control.root.info)

        print('      Left height -> ', tree_control.root.left_height)
Example #11
0
 def __init__(self):
     
     # Inherits from the QWidget class
     super().__init__()
     
     #Setting font
     self.setFont(QFont('Helvetica',25))
     # Get path to the script
     self.__dirtrs = os.path.dirname(os.path.abspath(__file__))
     #Connection to the Rover model
     self.__rover_model = ConnectionToModel()
     #timer
     self.__rover_timer = QtCore.QTimer(self)
     self.__rover_timer.timeout.connect(self.updateRover)  
     
     self.__satellites = None
        
     
     ######  RIGHT PART OF THE WIDGET  ######
     
     # Start Button
     self.__start_b = QPushButton('Start', self)
     self.__start_b.setCheckable(True)
     self.__start_b.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding)
     self.__start_b.toggled.connect(self.startRover)
     
     # Config Button
     self.__config_b = QPushButton('Config', self)
     self.__config_b.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.MinimumExpanding)
     self.__config_b.clicked.connect(self.openConfig)
            
     # Setting right part layout
     right_layout = QHBoxLayout()
     right_layout.addWidget(self.__start_b)
     right_layout.addWidget(self.__config_b)
     
     
     ######  LEFT PART OF THE WIDGET  ######
     
     # Rover image
     fig = QPixmap(self.__dirtrs +'/img/rover.png')  
     self.__icon = QLabel(self)
     self.__icon.setPixmap(fig)
     
     # Chrono
     self.__chrono_rover = Chronometer()
     
     
     # Setting left part layout
     left_layout = QVBoxLayout()
     left_layout.addWidget(self.__icon)
     left_layout.addWidget(self.__chrono_rover)
     
     
     ######  LOWER PART OF THE WIDGET  ######
     
     # Position indicators
     Sol_=QLabel('Sol:')
     Sol_.setAlignment(QtCore.Qt.AlignRight)
     Lat_=QLabel('Lat:')
     Lat_.setAlignment(QtCore.Qt.AlignRight)
     Lon_=QLabel('Lon:')
     Lon_.setAlignment(QtCore.Qt.AlignRight)
     Alt_=QLabel('Height:')
     Alt_.setAlignment(QtCore.Qt.AlignRight)
     
     # Calculated Position to be modified by updateRover()
     self.__lSol=QLabel('')       
     self.__lLat=QLabel('')      
     self.__lLon=QLabel('')       
     self.__lHeight=QLabel('')
     
     # Stream indicators
     status = QLabel('Stream Status:')
     status.setAlignment(QtCore.Qt.AlignLeft)
     self.__stream_status = QLabel('Not Started')
     self.__stream_status.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Minimum)
     
     
     # Setting lower part layout
     lower_layout = QHBoxLayout()
     
     lower_layout.addWidget(Sol_)
     lower_layout.addWidget(self.__lSol)
     lower_layout.addWidget(Lat_)
     lower_layout.addWidget(self.__lLat)
     lower_layout.addWidget(Lon_)
     lower_layout.addWidget(self.__lLon)
     lower_layout.addWidget(Alt_)
     lower_layout.addWidget(self.__lHeight)
     
     lower_layout2 = QHBoxLayout()
     lower_layout2.addWidget(status)
     lower_layout2.addWidget(self.__stream_status)
     
     ##### SETTING THE GLOBAL LAYOUT  ######
     
     rover_layout1 = QHBoxLayout()
     rover_layout1.addLayout(left_layout)
     rover_layout1.addLayout(right_layout)  
     
     rover_layout = QVBoxLayout()
     rover_layout.addLayout(rover_layout1)
     rover_layout.addLayout(lower_layout)
     rover_layout.addLayout(lower_layout2)
     self.setLayout(rover_layout)
Example #12
0
import time

from chronometer import Chronometer

a = Chronometer()
a.start()
time.sleep(1)
a.stop()
a.start()
time.sleep(2)
a.stop()
print(a)
print("time should be around 3 seconds")
def main():
    long_running_task = lambda: time.sleep(1.)

    with Chronometer() as t:
        long_running_task()  # that will take a few seconds.
    print('Phew, that took me {:.3f} seconds!'.format(float(t)))
Example #14
0
from sklearn import metrics
from sklearn.cluster import DBSCAN
import matplotlib.pyplot as plotter
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split

DEFAULT_STATION_BAUDRATE: int = 9600  # Baudrate Padrão para Comunicação Serial ou Bluetooth com os Slaves das Estações.
DEFAULT_SUPERVISOR_BAUDRATE: int = 4800  # Baudrate Padrão para Comunicação Serial ou Bluetooth com o Slave Supervisor.

DEFAULT_STATION_PORT: str = "/dev/ttyS6"  # Porta Padrão para Comunicação Serial ou Bluetooth com os Slaves das Estações.
DEFAULT_SUPERVISOR_PORT: str = "/dev/ttyS3"  # Porta Padrão para Comunicação Serial ou Bluetooth com o Slave Supervisor.

DATASET_FILE_PATH: str = "dataset.txt"  # Arquivo nos quais estão contidos os dados para feed no Algoritmo DBSCAN.
ERRORSET_FILE_PATH: str = "errorset.csv"  # Arquivo de armazenamento dos erros encontrados para feed no modelo de classificação Decision Tree.

timerStation: Chronometer = Chronometer(
)  # Cronômetro para o Tempo gasto em cada Estação.

stationThread: Thread = None  # Thread que executa a Await-For-Response do Arduino das Estações.
controlThread: Thread = None  # Thread que controla a Await-For-Response para parada, enquanto a `stationThread` está ocupada com o DBSCAN.

eventRoutine: bool = False  # Flag para input de comandos.

isRunning: bool = False  # Indica o estado de execução do parâmetro para os laços das Threads.
isControlActive: bool = False  # Indica o estado da Thread de Controle.

stationPort: Serial = None  # Entrada de Comunicação Serial da Estação.
supervisorPort: Serial = None  # Entrada de Comunicação Serial do Supervisor.

#   Limit = Average + STD * Threshold   ->  Limite para Suspeitar Anomalia.
threshold: float = 1  # Threshold - Parâmetro que multiplica o corte de desvio médio.
avg: float = 4  # Average   - Média dos valores de tempo do Dataset.
Example #15
0
def simulator():
    """
    Simulates the use of the Ucarpooling app
    """
    """Variables for statistics in the simulation"""
    max_time = 0
    total_time = 0
    total_errors = 0
    """Get the set of people that will request a carpooling partner"""
    rows = get_requesters()

    helper.info_message(
        f'==============STARTING SIMULATION=====================')
    """Iteraring for each row in the database for alumni"""
    with Chronometer() as time_simulation:

        total_row_count = len(rows)
        row_counter = 0
        helper.info_message(f'{total_row_count} records to check matching')

        for alumni in rows:

            print('=========================================')
            row_counter += 1
            helper.info_message(f'Progress: {row_counter}/{total_row_count}')

            alumni_token = alumni['token']
            alumni_id = alumni[settings.FIELDNAME_UUID.lower()]
            alumni_ucarpooling_id = alumni['ucarpoolingprofile_id']
            alumni_useritinerary_id = alumni['useritinerary_id']

            "GET the matches for the alumni"
            with Chronometer() as time_matching:
                response = requests.get(
                    url=get_matcher_url(alumni_useritinerary_id),
                    headers={"Authorization": f'Token {alumni_token}'})
            """Time statistics for the matcher of the back-end"""
            match_time = float(time_matching)
            helper.detail_message('Match for {} took {:.3f} seconds'.format(
                alumni_id, match_time))
            total_time += match_time
            max_time = match_time if max_time < match_time else max_time

            if response.status_code == 200:
                body_response = response.json()
                partners = get_carpooling_partner(body_response)
                if partners:
                    create_carpool(alumni_ucarpooling_id, partners,
                                   alumni_useritinerary_id)
                else:
                    helper.warning_message(
                        f'{alumni_id} had matches but did not travel with poolers'
                    )
            else:
                """The server did not respond a good result"""
                total_errors += 1
                if response.status_code == 420:
                    helper.warning_message(
                        f'{alumni_id} is already in a carpool')
                elif response.status_code == 204:
                    helper.no_matches_message(
                        f'{alumni_id} did not have any matches')
                    create_carpool(alumni_ucarpooling_id, [],
                                   alumni_useritinerary_id)
                else:

                    helper.error_message(
                        f'Error getting matches for alumni {alumni_id} '
                        f'---- status code: {response.status_code}: {response.reason}'
                    )
        """The simulation ended"""
        helper.info_message(
            '=================SIMULATION ENDED=====================')
        helper.detail_message(f'There was a total of {total_errors} errors')
        helper.detail_message(f'Max total match time: {max_time} seconds')
        helper.detail_message('Simulation runtime: {:.3f} seconds'.format(
            float(time_simulation)))
Example #16
0
def upload_users_itinerary():
    """
    Uploads all the generated users profile to api/ucarpooling/users/
    """

    alumni_auth = Table(settings.DATABASE_TABLE_AUTH)

    try:
        con = sqlite3.connect(settings.DATABASE)
        con.row_factory = sqlite3.Row

        cursorObj = con.cursor()

        """Building the query for retrieving all the users and their assigned profiles"""
        querystring = Query \
            .from_(Table(settings.DATABASE_TABLE_ALUMNI)) \
            .join(Table(settings.DATABASE_TABLE_ITINERARY)) \
            .on_field('uuid') \
            .join(Table(settings.DATABASE_TABLE_CARS)) \
            .on_field('uuid') \
            .select('*')\
            .limit(settings.LIMIT_USERS)

        # print(querystring.get_sql())
        """Executing the query"""
        rows = cursorObj.execute(querystring.get_sql()).fetchall()

        with Chronometer() as time_uploading:


            """Iteraring for each row in the database for alumni"""
            for alumni in rows:


                """Building the body in a json-like format for the boy of the POST request"""
                origen = f'{alumni[settings.FIELDNAME_LATITUDE.lower()]},{alumni[settings.FIELDNAME_LONGITUDE.lower()]}'
                toa = f'{date.today()}T{alumni[settings.FIELDNAME_TOA.lower()]}Z'
                body = {
                    "isDriver": True if alumni[settings.FIELDNAME_TRANSPORT.lower()] == 'Car' else False,
                    "origin": origen,
                    "destination": "-25.324491,-57.635437",  # Uca latitude and longitude
                    "timeOfArrival": toa
                }

                """Getting the token of the alumni for the POST header"""
                querystring = Query\
                    .from_(alumni_auth)\
                    .select(alumni_auth.token)\
                    .where(alumni_auth.uuid == alumni[settings.FIELDNAME_UUID.lower()])

                cursorObj.execute(querystring.get_sql())
                alumni_token = (cursorObj.fetchone())['token']

                """POST request for the itinerary"""
                response = requests.post(
                    url=settings.USER_ITINERARY_URL,
                    json=body,
                    headers={
                        "Authorization": f'Token {alumni_token}'  # Token og the Ucarpooling app
                    }
                )

                if response.status_code == 201:
                    helper.success_message(f'Uploaded successfully itinerary for alumni {alumni[settings.FIELDNAME_UUID.lower()]}')

                    body_response = response.json()
                    store_useritinerary_id(con, cursorObj, body_response['id'], alumni[settings.FIELDNAME_UUID.lower()])

                else:
                    helper.error_message(f'Error uploading itinerary for alumni {alumni[settings.FIELDNAME_UUID.lower()]} '
                                         f'---- status code: {response.status_code}: {response.reason}')

        """Uploading ended"""
        helper.info_message('=================UPLOADING ENDED=====================')
        helper.detail_message('Uploading runtime: {:.3f} seconds'.format(float(time_uploading)))

    except Error:

        print(Error)

    finally:

        """Closing the database connection"""
        con.close()
Example #17
0
from time import sleep
from chronometer import Chronometer

counter = 0


def long_running_task_that_can_fail():
    global counter
    counter += 1
    sleep(2.)
    return counter > 3


with Chronometer() as t:
    while not long_running_task_that_can_fail():
        print('Failed after {:.3f} seconds!'.format(t.reset()))
print('Success after {:.3f} seconds!'.format(float(t)))
Example #18
0
    def __init__(self):

        # Inherits from the QWidget class
        super().__init__()

        #Setting font
        self.setFont(QFont('Helvetica', 25))
        # Get path to the script
        self.__dirtrs = os.path.dirname(os.path.abspath(__file__))
        #Connection to the Base model
        self.__base_model = ConnectionToModel()
        #timer
        self.__base_timer = QtCore.QTimer(self)
        self.__base_timer.timeout.connect(self.updateBase)

        ######  RIGHT PART OF THE WIDGET  ######

        # Start Button
        self.__start_b = QPushButton('Start', self)
        self.__start_b.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.MinimumExpanding)
        self.__start_b.setCheckable(True)
        self.__start_b.toggled.connect(self.startBase)

        # Config Button
        self.__config_b = QPushButton('Config', self)
        self.__config_b.setSizePolicy(QSizePolicy.MinimumExpanding,
                                      QSizePolicy.MinimumExpanding)
        self.__config_b.clicked.connect(self.openConfig)

        # horizontal layout for the buttons
        right_layout = QHBoxLayout()
        right_layout.addWidget(self.__start_b)
        right_layout.addWidget(self.__config_b)

        ###### LEFT PART OF THE WIDGET  ######

        # Base image
        fig = QPixmap(self.__dirtrs + '/img/base.png')
        self.__icon = QLabel(self)
        self.__icon.setPixmap(fig)

        # Chrono
        self.__chrono_base = Chronometer()

        # Setting left part layout
        left_layout = QVBoxLayout()
        left_layout.addWidget(self.__icon)
        left_layout.addWidget(self.__chrono_base)

        ####### LOWER PART OF THE WIDGET ######
        status = QLabel('Stream Status:')
        status.setAlignment(QtCore.Qt.AlignLeft)
        self.__status_base = QLabel('Not Started')
        self.__status_base.setSizePolicy(QSizePolicy.Expanding,
                                         QSizePolicy.Minimum)

        lower_layout = QHBoxLayout()
        lower_layout.addWidget(status)
        lower_layout.addWidget(self.__status_base)

        ##### SETTING THE GLOBAL LAYOUT  ######

        base_layout = QHBoxLayout()
        base_layout.addLayout(left_layout)
        base_layout.addLayout(right_layout)

        base_layout2 = QVBoxLayout()
        base_layout2.addLayout(base_layout)
        base_layout2.addLayout(lower_layout)

        self.setLayout(base_layout2)
def chronometer(time_gun):
    return Chronometer(time_gun)