# grid2fp
A tool to eat grid diagrams and generate its front projections.
## Disclaimer
The tool is lightly tested. I would expect bugs and strange behavior. If you find something make an issue.
## Installation
Install with pip:
```
pip install grid2fp
```
## Usage
### CLI
Doesn't exist.
## Scripting
```python
from grid2fp import grid2fp
import drawsvg as draw
csv_path = "path"
svg_path = "path"
diagram = [["x","","o"],["","",""],["o","","x"]]
# Option 1
g = grid2fp(csv_file=csv_path,draw_crossings=False)
d = g.draw()
d.save_svg(svg_path)
# Option 2
grid2fp(csv_file=csv_path, out_file=svg_path)
# Option 3
g = grid2fp(diagram=diagram)
d = g.draw()
d.save_svg(svg_path)
# Option 4
g = grid2fp(csv_file=csv_path,string_color = "pink", crossing_color="purple")
d = g.draw()
# make some changes to d with drawsvg
d.save_svg(svg_path)
```
# Sample images
x|o| | |
-|-|-|-|
|x|o| |
| |x|o|
o| | |x|
<img style="background:white;width:400px;height:auto" src="https://github.com/Joecstarr/grid2fp/blob/main/test/random.svg"/>
o| | |x| |
-|-|-|-|-|
| |x| |o|
|x| |o| |
x| |o| | |
|o| | |x|
<img style="background:white;width:400px;height:auto" src="https://github.com/Joecstarr/grid2fp/blob/main/test/trefoil.svg"/>
x| |o|
-|-|-|
| | |
o| |x|
<img style="background:white;width:400px;height:auto" src="https://github.com/Joecstarr/grid2fp/blob/main/test/un.svg"/>
| |o| | |x| |
-|-|-|-|-|-|-|
| | | |o| |x|
|x| | | |o| |
o| |x| | | | |
| | |x| | |o|
|o| | |x| | |
x| | |o| | | |
<img style="background:white;width:400px;height:auto" src="https://github.com/Joecstarr/grid2fp/blob/main/test/fig1_from_paper.svg"/>
## ToDo
- [ ] CLI interface
- [x] fit canvas to drawing better.(still not perfect)
- [x] set string color
- [ ] ???
Raw data
{
"_id": null,
"home_page": "https://github.com/Joecstarr/grid2fp",
"name": "grid2fp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "topology,Legendrian,Grid Diagram,knot",
"author": "Joe Starr",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/71/e7/9ea06db143680fa4660bc55bf1178cd21e6117023934b665f4bf29e08957/grid2fp-0.0.8.tar.gz",
"platform": null,
"description": "# grid2fp\n\nA tool to eat grid diagrams and generate its front projections.\n\n## Disclaimer\nThe tool is lightly tested. I would expect bugs and strange behavior. If you find something make an issue.\n\n## Installation\n\nInstall with pip:\n\n```\npip install grid2fp\n```\n\n## Usage\n\n### CLI\nDoesn't exist.\n## Scripting\n\n\n```python\nfrom grid2fp import grid2fp\nimport drawsvg as draw\n\n\n\ncsv_path = \"path\"\nsvg_path = \"path\"\n\ndiagram = [[\"x\",\"\",\"o\"],[\"\",\"\",\"\"],[\"o\",\"\",\"x\"]]\n\n\n# Option 1\n\ng = grid2fp(csv_file=csv_path,draw_crossings=False)\nd = g.draw()\nd.save_svg(svg_path)\n\n# Option 2\ngrid2fp(csv_file=csv_path, out_file=svg_path)\n\n# Option 3\n\ng = grid2fp(diagram=diagram)\nd = g.draw()\nd.save_svg(svg_path)\n\n# Option 4\n\ng = grid2fp(csv_file=csv_path,string_color = \"pink\", crossing_color=\"purple\")\nd = g.draw()\n# make some changes to d with drawsvg\nd.save_svg(svg_path)\n\n```\n# Sample images\n\nx|o| | |\n-|-|-|-|\n |x|o| |\n | |x|o|\no| | |x|\n\n<img style=\"background:white;width:400px;height:auto\" src=\"https://github.com/Joecstarr/grid2fp/blob/main/test/random.svg\"/>\n\n\no| | |x| |\n-|-|-|-|-|\n | |x| |o|\n |x| |o| |\nx| |o| | |\n |o| | |x|\n\n\n<img style=\"background:white;width:400px;height:auto\" src=\"https://github.com/Joecstarr/grid2fp/blob/main/test/trefoil.svg\"/>\n\n\nx| |o|\n-|-|-|\n | | |\no| |x|\n\n<img style=\"background:white;width:400px;height:auto\" src=\"https://github.com/Joecstarr/grid2fp/blob/main/test/un.svg\"/>\n\n\n\u200e| |o| | |x| |\n-|-|-|-|-|-|-|\n | | | |o| |x|\n |x| | | |o| |\no| |x| | | | |\n | | |x| | |o|\n |o| | |x| | |\nx| | |o| | | |\n\n<img style=\"background:white;width:400px;height:auto\" src=\"https://github.com/Joecstarr/grid2fp/blob/main/test/fig1_from_paper.svg\"/>\n\n\n## ToDo\n- [ ] CLI interface\n- [x] fit canvas to drawing better.(still not perfect)\n- [x] set string color\n- [ ] ???\n",
"bugtrack_url": null,
"license": "",
"summary": "A tool to eat grid diagrams and generate its front projection.",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/Joecstarr/grid2fp"
},
"split_keywords": [
"topology",
"legendrian",
"grid diagram",
"knot"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f6f208c70538019c87a788ede0ac8ad672d4fa598a160d4e0abb8545c196bc91",
"md5": "0d94880668515f4ff9ab76a5a27b4524",
"sha256": "56cf2de5e289b392beb44bc6cbb48a51b5b4687f84d52145a95996edce1282c7"
},
"downloads": -1,
"filename": "grid2fp-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d94880668515f4ff9ab76a5a27b4524",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 17113,
"upload_time": "2023-10-30T01:59:36",
"upload_time_iso_8601": "2023-10-30T01:59:36.478209Z",
"url": "https://files.pythonhosted.org/packages/f6/f2/08c70538019c87a788ede0ac8ad672d4fa598a160d4e0abb8545c196bc91/grid2fp-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "71e79ea06db143680fa4660bc55bf1178cd21e6117023934b665f4bf29e08957",
"md5": "7fa08bba2158bac584a2d751b32ea034",
"sha256": "32f0ab006098b01922820d51f77e4a82f488043a1e0368de56aa69d8e448e4a4"
},
"downloads": -1,
"filename": "grid2fp-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "7fa08bba2158bac584a2d751b32ea034",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 16451,
"upload_time": "2023-10-30T01:59:37",
"upload_time_iso_8601": "2023-10-30T01:59:37.713750Z",
"url": "https://files.pythonhosted.org/packages/71/e7/9ea06db143680fa4660bc55bf1178cd21e6117023934b665f4bf29e08957/grid2fp-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-30 01:59:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Joecstarr",
"github_project": "grid2fp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "grid2fp"
}