def route_video_record(cmd):
        if cmd == "start":
            video_system.start_record()
        elif cmd == "stop":
            video_system.stop_record()

        return flask.Response("ok")
Beispiel #2
0
    def end_trial(self):

        if exp.get_params()["media_url"] is not None:
            mqtt.client.publish_json("event/command/hide_media", {})
        else:
            mqtt.client.publish_json("event/command/hide_bugs", {})

        if exp.get_params()["record_video"]:
            video_system.stop_record()
Beispiel #3
0
    def end(self):
        if exp.get_params().get("record_exp", True):
            video_system.stop_record()
        if self.cancel_trials != None:
            self.cancel_trials()

        schedule.cancel_all()
        mqtt.client.publish(topic="monitor/color", payload="black")

        self.log.info("exp ended")
    def end(self, params):
        # on end cancel all records and schedules
        if params.get("record_exp", True) or params["record_all"]:
            video_system.stop_record()
        if self.cancel_trials != None:
            self.cancel_trials()
        if self.cancel_logic_trial != None:
            self.cancel_logic_trial()
        schedule.cancel_all()
        mqtt.client.publish(topic="monitor/color", payload="black")
        exp.image_observers["head_bbox"].stop_observing()
        self.yolo_log.stop()

        if exp.state["arena", "signal_led"]:
            arena.signal_led(False)
        mqtt.client.unsubscribe("reptilearn/pogona_head_bbox")
        mqtt.client.unsubscribe("reptilearn/learn_exp/end")
        self.log.info("exp ended")
    def end_logic_trial(self):
        params = exp.get_merged_params()
        self.stim_cancel()  # canceling stimulus, if active.
        if params["stimulus"] == "monitor":
            monitor.chnage_color("black")
        timestap = time.time()
        # logging trial data
        if self.in_trial and not self.got_detection:
            self.log.info("Logic trial ended, failure")
            exp.event_logger.log(
                "learn_exp/logical_trial_ended",
                {
                    "type": self.ex_type,
                    "success": False
                },
            )
        elif self.in_trial and self.got_detection:
            self.log.info("Logic trial ended, success")
            exp.event_logger.log("learn_exp/logical_trial_ended", {
                "type": self.ex_type,
                "success": True
            })
        else:
            self.log.info("Logic trial ended")

        # continuous trial: schedule the next.
        self.in_trial = False
        self.got_detection = False
        if params.get("continuous", False):
            if params["record_exp"] and not params["record_all"]:
                video_system.stop_record()
            self.cancel_trials()
            self.cancel_trials = schedule.repeat(self.period_call, interval,
                                                 self.cur_trial - 1)
        elif self.consecutive:
            if params["record_exp"] and not params["record_all"]:
                schedule.once(lambda: video_system.stop_record(),
                              params.get("record_overhead", 0))
            if self.cur_trial > 0:
                exp.next_trial()
        else:
            if params["record_exp"] and not params["record_all"]:
                schedule.once(lambda: video_system.stop_record(),
                              params.get("record_overhead", 0))
    def end_trial(self, params):
        if self.in_trial:
            self.log.info("Logic trial wasnt finished!")
            if params.get("record_exp", True) and not params["record_all"]:
                schedule.once(lambda: video_system.stop_record(),
                              params.get("record_overhead", 0))
            if params["stimulus"] == "monitor":
                monitor.chnage_color("black")
            self.in_trial = False
            self.got_detection = False

        self.cur_trial = self.cur_trial - 1
 def end(self):
     monitor.clear()
     self.cancel_sequence()
     video_system.stop_record()
 def on_day_end(self):
     arena.run_command("set", "AC Line 2", [0])
     arena.run_command("set", "AC Line 1", [0])
     video_system.stop_record()
     arena.stop_trigger()
     self.bbox_collector.stop()
Beispiel #9
0
 def end(self):
     self.bbox_collector.end()
     if exp.get_params()["record_video"]:
         video_system.stop_record()
def stop_record(log):
    log.info("Stopping video recording.")
    video_system.stop_record()
Beispiel #11
0
 def end(self):
     if exp.get_params()["record_video"]:
         video_system.stop_record()
 def end(self):
     self.bbox_collector.end()
     session_state.remove_callback("is_in_area")
     if exp.get_params()["record_video"]:
         video_system.stop_record()