Skip to main content

A graphical user interface for tilings.

Project description

A graphical interface for Tilings.

Install and run

pip install tilingsgui
tilingsgui
tilingsgui -j 'tilingsgui json object'

Note for Linux

Pyperclip requires clipboard tools that might not come pre-installed.

sudo apt-get install xclip

Without them the app still works but pasting won’t.

Known issues

Report a bug

Along with the description of the bug, please provide a json of the tiling which is exportable in the gui.

User manual

Summary

  • img-error Point insertion

  • img-error Permutation insertion

  • img-error Export

  • img-error Factor

  • img-error Factor with interleaving

  • img-error Fusion with column set

  • img-error Fusion with row set

  • img-error Component fusion with column set

  • img-error Component fusion with row set

  • img-error Highlight hovered cell

  • img-error Move

  • img-error Obstruction transitivity

  • img-error East placement

  • img-error North placement

  • img-error South placement

  • img-error West placement

  • img-error East partial placement

  • img-error North partial placement

  • img-error South partial placement

  • img-error West partial placement

  • img-error Pretty points

  • img-error Undo

  • img-error Redo

  • img-error Row column separation

  • img-error Sequece

  • img-error Shading

  • img-error Show crossing

  • img-error Show localized

  • img-error Print

  • img-error Verification

  • img-error Tikz

  • img-error Obstruction inferral

Tiling input

The input box directly above the tiling canvas can be used to create an initial tiling. It accepts both strings and json, using from_string and from_json respectively. A right click activates it. To confirm your input, press enter or click away from the text box. Escape cancels the input. Right clicking when activated will paste whatever is on the clipboard.

Example: The following two inputs are two ways of producing the same initial tiling.

1432_12345

{"class_module": "tilings.tiling", "comb_class": "Tiling", "obstructions": [{"patt": [0, 3, 2, 1], "pos": [[0, 0], [0, 0], [0, 0], [0, 0]]}, {"patt": [0, 1, 2, 3, 4], "pos": [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]}], "requirements": [], "assumptions": []}

The initial tiling in question would be the following.

+-+
|1|
+-+
1: Av(0321, 01234)

Cell insertion

To insert a permutation into a single cell, one can choose either to add a point, img-error, or a custom permutation, img-error. For the latter, the latest confirmed input in the text box above the button grid is used. The text box works just like the one for inputting tilings. It uses to_standard to convert the input to a permutation. After having selected the permutation to insert, then clicking a cell will insert it. Left click inserts it as a requirement while a right click inserts it as a obstruction, using add_single_cell_requirement and add_single_cell_obstruction respectively.

Factor

There are two types of factorization, factor img-error and factor with interleaving img-error. In both cases they are applied to the cell that is clicked. Two active cells are in the same factor if they are in the same row or column, or they share an obstruction or a requirement. For factoring with interleaving, two non-empty cells are in the same factor if they share an obstruction or a requirement.

Place points

By clicking a point of a requirement, we pass its gridded permutation along with its index within it to place_point_of_gridded_permutation and the direction set by the button chosen, east img-error, north img-error, south img-error or west img-error.

def place_point_of_gridded_permutation(
        self, gp: GriddedPerm, idx: int, direction: int
    ) -> "Tiling":
        """
        Return the tiling where the directionmost occurrence of the idx point
        in the gridded permutaion gp is placed.
        """

Partially place points

By clicking a point of a requirement, we pass its gridded permutation along with its index within it to partial_place_point_of_gridded_permutation and the direction set by the button chosen, east img-error, north img-error, south img-error or west img-error.

def partial_place_point_of_gridded_permutation(
    self, gp: GriddedPerm, idx: int, direction: int
) -> "Tiling":
    """
    Return the tiling where the directionmost occurrence of the idx point
    in the gridded permutaion gp is placed. The point is placed onto its
    own row or own column depending on the direction.
    """

Fusion

Let c_r and c_c be the row and column respectively of the clicked cell. There are 4 types of fusions available. Fusion with row=c_r, img-error, fusion with col=c_c, img-error, component fusion with row=c_r, img-error, and component fusion with col=c_c, img-error. If the fusion are invalid, then exceptions are caught and nothing happens.

Fusion:

"""
Fuse the tilings.
If `row` is not `None` then `row` and `row+1` are fused together.
If `col` is not `None` then `col` and `col+1` are fused together.
"""

Component fusion:

"""
Fuse the tilings in such a way that it can be unfused by drawing a line between skew/sum-components.
If `row` is not `None` then `row` and `row+1` are fused together.
If `col` is not `None` then `col` and `col+1` are fused together.
"""

Undo and redo

Given that there are previously drawn tilings, then undo, img-error, will redraw the one before the last action. If you wish to revert the undo, you can use redo, img-error. There is a limit on how many tilings are stored in memory.

Row column separation

img-error splits the row and columns of a tilings using the inequalities implied by the length two obstructions.

Obstruction transitivity

img-error adds length 2 obstructions to the tiling using transitivity over positive cells.

Export

Export, img-error, will store the current tiling in memory and upon closing the app, will add all stored tilings in the session to ./export/history.json. There is a session limit so the file become too large. If the session limit is reached, than adding more will remove the oldest. The format of the json can be seen below with time and tiling values empty. Any time export is used, a copy of the history is placed in the current working directory.

[
  {
    "session_time": "",
    "tilings": [
      {
        "tiling_time": "",
        "tiling": {}
      },
      {
        "tiling_time": "",
        "tiling": {}
      }
    ]
  },
  {
    "session_time": "",
    "tilings": [
      {
        "tiling_time": "",
        "tiling": {}
      }
    ]
  }
]

Print

Writing the current tiling to stdout, img-error, will produce both the __str__ and __repr__ representation of the tiling. An example output is shown below.

+-+-+-+
| || |
+-+-+-+
|1| |1|
+-+-+-+
1: Av(021)
●: point
Crossing obstructions:
01: (0, 0), (2, 0)
Requirement 0:
0: (1, 1)

Tiling(obstructions=(GriddedPerm(Perm((0,)), ((0, 1),)), GriddedPerm(Perm((0,)), ((1, 0),)), GriddedPerm(Perm((0,)), ((2, 1),)), GriddedPerm(Perm((0, 1)), ((0, 0), (2, 0))), GriddedPerm(Perm((0, 1)), ((1, 1), (1, 1))), GriddedPerm(Perm((1, 0)), ((1, 1), (1, 1))), GriddedPerm(Perm((0, 2, 1)), ((0, 0), (0, 0), (0, 0))), GriddedPerm(Perm((0, 2, 1)), ((2, 0), (2, 0), (2, 0)))), requirements=((GriddedPerm(Perm((0,)), ((1, 1),)),),), assumptions=())

Sequence

The first few terms of the sequence of gridded permutations griddable on the current tiling can be written to stdout, img-error, where for example the following tiling

+-+-+-+-+
| || | |
+-+-+-+-+
|1| |1| |
+-+-+-+-+
| | | ||
+-+-+-+-+
| | |1| |
+-+-+-+-+
1: Av(021)
●: point
Crossing obstructions:
01: (0, 2), (2, 2)
01: (2, 0), (2, 2)
Requirement 0:
0: (1, 3)
Requirement 1:
0: (3, 1)

would produce this output.

[0, 0, 1, 3, 9, 28, 90, 297]

Shading

With shading on, img-error, then a 1 restriction is not drawn as a point but rather as a filled cell.

Pretty points

With pretty points on, img-error, then 12 and 21 restrictions along with a 1 requirement within the same cell are drawn as a single point.

Show localized

With localized shown, img-error, requirements and obstructions that are contained in a single cell are shown. Without it they are not.

Show crossing

With crossing shown, img-error, requirements and obstructions that reach across different cells are shown. Without it they are not.

Highlight hovered cell

Turning on the hovered cell highlighting, img-error, obstructions in the hovered cell are colored differently.

Obstruction inferral

Add all obstructions up to a length that does not change the set of gridded permutations. Pressing img-error will use the upper right input box to determine the lenght. It is maxed at 7 and defaults to 3.

Tikz

Use img-error to produce the current tiling with the current positions as a tikz figure.

Verification

Given a tiling t, the verification button, img-error, will produce the following result.

[
   BasicVerificationStrategy().verified(t),
   DatabaseVerificationStrategy().verified(t),
   ElementaryVerificationStrategy().verified(t),
   InsertionEncodingVerificationStrategy().verified(t),
   LocallyFactorableVerificationStrategy().verified(t),
   LocalVerificationStrategy(no_factors=False).verified(t),
   MonotoneTreeVerificationStrategy().verified(t),
   OneByOneVerificationStrategy().verified(t)
]

An example output is shown below.

BasicVerificationStrategy             : True
DatabaseVerificationStrategy          : False
ElementaryVerificationStrategy        : False
InsertionEncodingVerificationStrategy : True
LocallyFactorableVerificationStrategy : False
LocalVerificationStrategy             : True
MonotoneTreeVerificationStrategy      : False
OneByOneVerificationStrategy          : True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tilingsgui-0.2.3.tar.gz (482.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page