예제 #1
0
def main():
    env = Env()
    env.logger = logging.Logger("data/tmp.h5")

    env.reset()

    while True:
        env.render()
        done = env.step()
        if done:
            break

    env.close()

    figure.plot()
예제 #2
0
파일: widget.py 프로젝트: nanharder/calECSA
 def optimize_cur():
     try:
         level_ = int(level.get())
         data = engine.optimize_bg(level_)
         frame_init()
         fig, axs = figure.plot(frame_fig)
         plot.cur_plot(axs, data)
     except ValueError as e:
         mb.showerror("请输入正确格式的值")
예제 #3
0
파일: widget.py 프로젝트: nanharder/calECSA
    def reset_fig():
        frame_init()
        fig, axs = figure.plot(frame_fig)
        if engine.get_raw_index() >= 0:
            plot.raw_plot(axs, engine.get_raw())
        else:
            plot.pre_all_data(axs, engine.get_all_data(), 1)

        result.delete(1.0, END)
        result.insert(END, "重置完毕")
예제 #4
0
파일: widget.py 프로젝트: nanharder/calECSA
    def pre_select_data():
        try:
            index = int(data_index.get())
            if 0 < index <= engine.get_all_data_size():
                frame_init()
                fig, axs = figure.plot(frame_fig)
                plot.pre_all_data(axs, engine.get_all_data(), index)
                result.delete(1.0, END)
                result.insert(
                    END, "加载数据完毕,共有%d个周期,当前红色曲线是第%d个周期" %
                    (engine.get_all_data_size(), index))
            else:
                mb.showerror("输入的值不在周期范围内")

        except ValueError:
            mb.showerror("请输入正确格式的值")
예제 #5
0
파일: widget.py 프로젝트: nanharder/calECSA
    def line_background():
        try:
            x1_ = float(x1.get())
            x2_ = float(x2.get())
            y1_ = float(y1.get())
            y2_ = float(y2.get())
            if x1_ == x2_ and y1_ == y2_:
                mb.showerror("请输入两个不同的点")
            else:
                data = engine.optimize_line(x1_, y1_, x2_, y2_)
                frame_init()
                fig, axs = figure.plot(frame_fig)
                plot.cur_plot(axs, data)

        except ValueError:
            mb.showerror("请输入正确格式的值")
예제 #6
0
파일: widget.py 프로젝트: nanharder/calECSA
    def set_bound():
        try:
            left_bound_ = float(left_bound.get())
            right_bound_ = float(right_bound.get())
            left_peak_ = float(left_peak.get())
            right_peak_ = float(right_peak.get())

            if left_bound_ < left_peak_ < right_peak_ < right_bound_:
                engine.set_bound(left_bound_, right_bound_, left_peak_,
                                 right_peak_)
                res = engine.get_detail_data()
                frame_init()
                fig, axs = figure.plot(frame_fig)
                plot.pre_plot(axs, res)
            else:
                mb.showerror("设定参数大小顺序不正确")
        except ValueError as e:
            mb.showerror("请输入正确格式的数字")
예제 #7
0
파일: widget.py 프로젝트: nanharder/calECSA
    def load_data_from_file():
        filepath = path.get()
        engine.clear()
        result.delete(1.0, END)
        engine.set_filepath(filepath)
        if filepath is None or len(filepath) == 0:
            mb.showerror("提示:路径不能为空")
        elif not os.path.exists(filepath):
            mb.showerror("目标文件不存在")
        else:
            engine.load_data()

            data_index.set(str(1))
            frame_init()
            fig, axs = figure.plot(frame_fig)
            plot.pre_all_data(axs, engine.get_all_data(), 1)
            result.delete(1.0, END)
            result.insert(
                END, "加载数据完毕,共有%d个周期,当前显示的是第%d个周期" %
                (engine.get_all_data_size(), 1))
예제 #8
0
파일: widget.py 프로젝트: nanharder/calECSA
 def find_bg():
     nonlocal x1, x2, y1, y2
     frame_init()
     fig, axs = figure.plot(frame_fig)
     plot.find_bg(axs, fig, engine.get_detail_data(), eval(bg_x),
                  eval(bg_y))
예제 #9
0
파일: widget.py 프로젝트: nanharder/calECSA
 def find_bound():
     nonlocal left_bound, right_bound, left_peak, right_peak
     frame_init()
     fig, axs = figure.plot(frame_fig)
     plot.find_pos(axs, fig, engine.get_raw(), eval(bound_name))
예제 #10
0
def modify_doc(doc):

    layout = plot(400, 400)
    doc.add_root(layout)
    #
    doc.theme = Theme(filename="theme.yaml")