knitout-interpreter


Nameknitout-interpreter JSON
Version 0.0.12 PyPI version JSON
download
home_pageNone
SummarySupport for interpreting knitout files used for controlling automatic V-Bed Knitting machines.
upload_time2024-11-13 19:58:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords act lab northeastern fabrication knit machine knit textile
VCS
bugtrack_url
requirements parglare importlib_resources knit-graphs virtual-knitting-machine nodejs-bin
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# knitout_interpreter

[![PyPI - Version](https://img.shields.io/pypi/v/knitout-interpreter.svg)](https://pypi.org/project/knitout-interpreter)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/knitout-interpreter.svg)](https://pypi.org/project/knitout-interpreter)

-----
## Description
Support for interpreting knitout files used for controlling automatic V-Bed Knitting machines. This complies with the [Knitout specification](https://textiles-lab.github.io/knitout/knitout.html) created by McCann et al. 

## Table of Contents
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
  - [Run Knitout](#run-knitout)
  - [Knitout Executer](#knitout-executer)
- [License](#license)

## Installation

```console
pip install knitout-interpreter
```

## Usage

### Run Knitout
To execute a knitout file (e.g., "example.k") on a virtual knitting machine, you can use the run_knitout function from the [run_knitout Module](https://github.com/mhofmann-Khoury/knitout_interpreter/blob/main/src/knitout_interpreter/run_knitout.py). 
This will return a list of knitout-line objects in the order of execution,
the virtual knitting machine created and after the knitout operations have completed, and the knitgraph that is rendered by these knitout operations.

```python

from knitout_interpreter.run_knitout import run_knitout

knitout_lines, knitting_machine_state, knitted_knit_graph = run_knitout("example.k")
```

In addition to processing the knitout instructions into a list of instructions that executed on a virtual machine, this package supports interoperation with existing knitout compilers to Shima Seiki DAT files and Kniterate files. 

To interpret and convert the knitout code to a DAT file, execute the following:
```python
from knitout_interpreter.run_knitout import interpret_knitout
success= interpret_knitout("sample.k", "sample.dat")
```

The resulting DAT files can be viewed using the [Dat Viewer Interface from the CMU Textiles Lab](https://github.com/mhofmann-Khoury/knitout_interpreter/tree/main/src/knitout_interpreter/knitout_compilers/dat-viewer.html).

To generate Kniterate KCODE using the  [CMU Textiles Lab Kniterate compiler](https://github.com/textiles-lab/knitout-backend-kniterate), modify the code as follows.
```python
from knitout_interpreter.run_knitout import interpret_knitout
from knitout_interpreter.knitout_compilers.compile_knitout import Knitout_to_Machine_Compiler
success= interpret_knitout("sample.k", "sample.dat", Knitout_to_Machine_Compiler.Kniterate_Compiler)
```
### Knitout Executer

The [Knitout Execute Class](https://github.com/mhofmann-Khoury/knitout_interpreter/blob/main/src/knitout_interpreter/knitout_execution.py) provides additional support for analyzing an executed knitout program. 

It provides the following functionality:
- Determining the execution time of a knitout program measured in carriage passes (not lines of knitout).
- Finding the left and right most needle indices that are used during execution. This can be used to determine the width needed on a knitting machine.
- Testing the knitout instructions against common knitting errors
- Reorganizing a knitout program into carriage passes (such as sorting xfers to be in carriage pass order) and writing these out to a new file. 

## License

`knitout-interpreter` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "knitout-interpreter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "ACT Lab, Northeastern, fabrication, knit, machine knit, textile",
    "author": null,
    "author_email": "Megan Hofmann <m.hofmann@northeastern.edu>",
    "download_url": "https://files.pythonhosted.org/packages/27/ae/69597e1efc05d18c4709485438b6a937394b864a43e8c67d6d9720b845bc/knitout_interpreter-0.0.12.tar.gz",
    "platform": null,
    "description": "\n# knitout_interpreter\n\n[![PyPI - Version](https://img.shields.io/pypi/v/knitout-interpreter.svg)](https://pypi.org/project/knitout-interpreter)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/knitout-interpreter.svg)](https://pypi.org/project/knitout-interpreter)\n\n-----\n## Description\nSupport for interpreting knitout files used for controlling automatic V-Bed Knitting machines. This complies with the [Knitout specification](https://textiles-lab.github.io/knitout/knitout.html) created by McCann et al. \n\n## Table of Contents\n- [Description](#description)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Run Knitout](#run-knitout)\n  - [Knitout Executer](#knitout-executer)\n- [License](#license)\n\n## Installation\n\n```console\npip install knitout-interpreter\n```\n\n## Usage\n\n### Run Knitout\nTo execute a knitout file (e.g., \"example.k\") on a virtual knitting machine, you can use the run_knitout function from the [run_knitout Module](https://github.com/mhofmann-Khoury/knitout_interpreter/blob/main/src/knitout_interpreter/run_knitout.py). \nThis will return a list of knitout-line objects in the order of execution,\nthe virtual knitting machine created and after the knitout operations have completed, and the knitgraph that is rendered by these knitout operations.\n\n```python\n\nfrom knitout_interpreter.run_knitout import run_knitout\n\nknitout_lines, knitting_machine_state, knitted_knit_graph = run_knitout(\"example.k\")\n```\n\nIn addition to processing the knitout instructions into a list of instructions that executed on a virtual machine, this package supports interoperation with existing knitout compilers to Shima Seiki DAT files and Kniterate files. \n\nTo interpret and convert the knitout code to a DAT file, execute the following:\n```python\nfrom knitout_interpreter.run_knitout import interpret_knitout\nsuccess= interpret_knitout(\"sample.k\", \"sample.dat\")\n```\n\nThe resulting DAT files can be viewed using the [Dat Viewer Interface from the CMU Textiles Lab](https://github.com/mhofmann-Khoury/knitout_interpreter/tree/main/src/knitout_interpreter/knitout_compilers/dat-viewer.html).\n\nTo generate Kniterate KCODE using the  [CMU Textiles Lab Kniterate compiler](https://github.com/textiles-lab/knitout-backend-kniterate), modify the code as follows.\n```python\nfrom knitout_interpreter.run_knitout import interpret_knitout\nfrom knitout_interpreter.knitout_compilers.compile_knitout import Knitout_to_Machine_Compiler\nsuccess= interpret_knitout(\"sample.k\", \"sample.dat\", Knitout_to_Machine_Compiler.Kniterate_Compiler)\n```\n### Knitout Executer\n\nThe [Knitout Execute Class](https://github.com/mhofmann-Khoury/knitout_interpreter/blob/main/src/knitout_interpreter/knitout_execution.py) provides additional support for analyzing an executed knitout program. \n\nIt provides the following functionality:\n- Determining the execution time of a knitout program measured in carriage passes (not lines of knitout).\n- Finding the left and right most needle indices that are used during execution. This can be used to determine the width needed on a knitting machine.\n- Testing the knitout instructions against common knitting errors\n- Reorganizing a knitout program into carriage passes (such as sorting xfers to be in carriage pass order) and writing these out to a new file. \n\n## License\n\n`knitout-interpreter` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Support for interpreting knitout files used for controlling automatic V-Bed Knitting machines.",
    "version": "0.0.12",
    "project_urls": {
        "Documentation": "https://github.com/mhofmann-Khoury/knitout_interpreter#readme",
        "Issues": "https://github.com/mhofmann-Khoury/knitout_interpreter/issues",
        "Source": "https://github.com/mhofmann-Khoury/knitout_interpreter"
    },
    "split_keywords": [
        "act lab",
        " northeastern",
        " fabrication",
        " knit",
        " machine knit",
        " textile"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e00e5c50c5cd5a8b2917c6094172c5649af2db2466eebbb5d1c301e8849c5174",
                "md5": "2dfbdc7e4e30c3a3d94690706debef99",
                "sha256": "80752c544929c71ffd27876dc48add23d10c541fe8bce80370e5d9c4525d11e2"
            },
            "downloads": -1,
            "filename": "knitout_interpreter-0.0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2dfbdc7e4e30c3a3d94690706debef99",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 68963,
            "upload_time": "2024-11-13T19:58:03",
            "upload_time_iso_8601": "2024-11-13T19:58:03.579855Z",
            "url": "https://files.pythonhosted.org/packages/e0/0e/5c50c5cd5a8b2917c6094172c5649af2db2466eebbb5d1c301e8849c5174/knitout_interpreter-0.0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27ae69597e1efc05d18c4709485438b6a937394b864a43e8c67d6d9720b845bc",
                "md5": "06f4b8b4f56a2c564cd3651cafb39af0",
                "sha256": "38d72ffd329a64bbf51f4bc43c3996d469d4e2a6d0bf65e1c28beefa003c23c3"
            },
            "downloads": -1,
            "filename": "knitout_interpreter-0.0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "06f4b8b4f56a2c564cd3651cafb39af0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 4610,
            "upload_time": "2024-11-13T19:58:04",
            "upload_time_iso_8601": "2024-11-13T19:58:04.658343Z",
            "url": "https://files.pythonhosted.org/packages/27/ae/69597e1efc05d18c4709485438b6a937394b864a43e8c67d6d9720b845bc/knitout_interpreter-0.0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-13 19:58:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mhofmann-Khoury",
    "github_project": "knitout_interpreter#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "parglare",
            "specs": [
                [
                    "~=",
                    "0.16.1"
                ]
            ]
        },
        {
            "name": "importlib_resources",
            "specs": []
        },
        {
            "name": "knit-graphs",
            "specs": [
                [
                    "~=",
                    "0.0.4"
                ]
            ]
        },
        {
            "name": "virtual-knitting-machine",
            "specs": [
                [
                    "~=",
                    "0.0.9"
                ]
            ]
        },
        {
            "name": "nodejs-bin",
            "specs": []
        }
    ],
    "lcname": "knitout-interpreter"
}
        
Elapsed time: 1.02695s