Giter VIP home page Giter VIP logo

optiblocks's Introduction


OptiBlocks

Optimization components for accelerator tools

About

This repo contains 'mostly-standalone' pieces of apsopt that might be of interest to the community. They can be used as is by importing the package, or feel free to just copy/paste.

Getting started

Prerequisites

  • Python >= 3.8
  • pyqt >= 5.12
  • pyqt-test
  • pyqtgraph

Contents

Pydantic parameter tree

Extension/rewrite of the pyqtgraph ParameterTree system to support reading and writing Pydantic models.

The key implementation challenge is how to validate and handle edits of child elements - this must be done in the first available parent model, but copies of fields should be avoided because those objects might contain other state. For now, only a subset of object types are supported: BaseModel, primitive types, dict, and list. Nesting to arbitrary depth should work fine, but note that validation/copying/assignment will always be done on per-field basis.

The structure of parameters is:

graph
    Model --> PrimitiveField;
    Model --> ListField;
    Model --> DictField;
    Model --> SubModel;
    ListField --> PrimitiveParameter;
    ListField --> PrimitiveContainer;
    DictField --> PrimitiveParameter2;
    DictField --> PrimitiveContainer2;

Example GUI

An example is included in the /scripts/tree/sample_gui.py. It reflects the model defined in /scripts/tree/sample_model.py

GUI testing with pyqt-test

A demonstration of GUI testing with pyqt-test is provided in /scripts/tree/test_tree.py. Unlike standard tests, GUI tests simulate interactions with various elements by setting text box values, pressing buttons, etc. Resulting state is then verified through the pydantic model.

optiblocks's People

Contributors

nikitakuklev avatar

Stargazers

Zhe Zhang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.