Ejemplo n.º 1
0
    def update_count_rates(self, count_rates):
        '''
        The postprocessing system sent us new count rates.
        Process them, and forward the filtered counts onto the graph
        '''

        filtered_count_rates = []

        for block in self.blocks:
            pattern = block.get_input().strip()
            if len(pattern) > 0:
                value = parse_coincidence_pattern(pattern, count_rates)
                block.set_output(value)
                filtered_count_rates.append({
                    'pattern': pattern,
                    'count': value,
                    'index': block.index
                })
            else:
                block.set_output(None)

        if self.beep and len(filtered_count_rates) > 0:
            beeper.beep(filtered_count_rates[0]['count'])

        return filtered_count_rates
Ejemplo n.º 2
0
def reset_game(sound=True):
    global players
    global game_timer
    global player_1_reg_time
    global player_2_reg_time
    global players_count

    players = dict()
    game_timer = None
    player_1_reg_time = None
    player_2_reg_time = None
    players_count = 0

    if sound:
        beep(beeps=3)
Ejemplo n.º 3
0
    def update_count_rates(self, count_rates):
        '''
        The postprocessing system sent us new count rates.
        Process them, and forward the filtered counts onto the graph
        '''

        filtered_count_rates = []

        for block in self.blocks:
            pattern = block.get_input().strip()
            if len(pattern) > 0:
                value = parse_coincidence_pattern(pattern, count_rates)
                block.set_output(value)
                filtered_count_rates.append({'pattern': pattern,
                                             'count': value, 'index': block.index})
            else:
                block.set_output(None)

        if self.beep and len(filtered_count_rates) > 0:
            beeper.beep(filtered_count_rates[0]['count'])

        return filtered_count_rates
Ejemplo n.º 4
0
import time
import beeper

start = int(input("how many seconds? "))

# count down from start to 0

remaining = start
while remaining >= 1:
    print(remaining, "seconds left")
    remaining -= 1
    time.sleep(1)

beeper.beep(10)
Ejemplo n.º 5
0
            continue

        if uid not in players and players_count < 2:
            try:
                user_data = poolbot.get_user(uid)
            except IndexError:
                logging.debug("NFC tag not tied with any user.")
                continue

            user_data = poolbot.get_user(uid)
            players[uid] = user_data

            players_count = len(players)
            locals()['player_{}_reg_time'.format(players_count)] = dt.now()
            logging.debug("{} registered.".format(user_data['username']))
            beep()

        if uid in players and game_timer:  # Only current players are allowed to end the game
            winner_data = players.pop(uid)
            loser_data = players.values()[0]

            logging.debug("{} has won a match against {}.".format(
                winner_data['username'], loser_data['username']))
            logging.debug("Game took {}".format(
                str(timedelta(seconds=time_elapsed))))

            poolbot.send_result_to_slack(
                winner_data['slack_id'],
                loser_data['slack_id'],
                timedelta(seconds=time_elapsed),
            )
Ejemplo n.º 6
0
import time
import beeper

seconds = input("how many seconds? [q for quit] ")

while seconds != "q":
    seconds = int(seconds)

    while seconds > 0:
        print(seconds, "remaining")
        time.sleep(1)
        seconds -= 1
            
    print("beep beep beep")
    beeper.beep(3)

    seconds = input("how many seconds? [q for quit] ")