# PyIgor
PyIgor facilitates communication between Python and WaveMetrics Igor Pro, enabling seamless data and command exchange.
## Requirements
- **Igor Pro 7.0 or later:** Ensure you have Igor Pro 7.0 or a newer version installed.
- **HDF5 XOP:** Install the HDF5 XOP module. Detailed installation instructions are available in the "HDF5 installation" section under Igor Pro's help topics.
- **PyIgor Procedure File:** Download the `pyigor.ipf` file from [GitHub](https://github.com/chocolate-icecream/pyigor/blob/master/pyigor.ipf) and place it in the Igor Procedures folder for convenience.
## Installation
To install PyIgor, use the following pip command:
```bash
pip install pyigor
```
## Usage
Note: Ensure Igor Pro is running before executing these commands. If Igor Pro is not already running, the commands will start Igor Pro and pause until the process completes.
### Accessing Igor Pro from Python
Here’s how you can interact with Igor Pro using PyIgor:
```python
from pyigor import Connection
import numpy as np
# Establish a connection with Igor Pro
igor = Connection()
# Send a numpy array to Igor Pro
array = np.sin(np.linspace(0, 10, 100))
igor.put(array, "sinwave")
# Execute a command in Igor Pro
igor("sinwave += 1")
# Retrieve a wave from Igor Pro
wv = igor.get("sinwave")
print(wv.array)
```
### Accessing Python from Igor Pro
#### Preparing Python
```python
from pyigor import Connection
# Establish a connection
igor = Connection()
# Register a function callable from Igor Pro
@igor.function
def myfunc(a):
return a * a
# Keep the connection open; not required in interactive mode
igor.wait_done()
```
Use the `Connection(security_hole=True)` option to call any Python code from Igor Pro. This setting allows executing Python code through HTTP requests to `http://localhost/code` using `eval(code)`. **Important:** Use this option only if you understand the security implications.
#### Calling Python Functions from Igor Pro
Execute Python functions registered via PyIgor from Igor Pro:
```igorpro
print PyIgorCall("myfunc(10)")
```
## Security Note
When enabling `security_hole=True`, ensure your environment is secure and understand the risks associated with executing arbitrary code.
## Contributors
A special thanks to the people who have contributed to this project:
- [@nlyamada](https://github.com/nlyamada) - Made compatible with Windows
Raw data
{
"_id": null,
"home_page": "https://github.com/chocolate-icecream/pyigor",
"name": "pyigor",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "Igor",
"author": "chocolate-icecream",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ef/e0/b96b36f28d7bf271639603e709316aa7d4ea5c0adebae6a05b73b1ad649e/pyigor-0.2.3.tar.gz",
"platform": null,
"description": "# PyIgor\n\nPyIgor facilitates communication between Python and WaveMetrics Igor Pro, enabling seamless data and command exchange.\n\n## Requirements\n\n- **Igor Pro 7.0 or later:** Ensure you have Igor Pro 7.0 or a newer version installed.\n- **HDF5 XOP:** Install the HDF5 XOP module. Detailed installation instructions are available in the \"HDF5 installation\" section under Igor Pro's help topics.\n- **PyIgor Procedure File:** Download the `pyigor.ipf` file from [GitHub](https://github.com/chocolate-icecream/pyigor/blob/master/pyigor.ipf) and place it in the Igor Procedures folder for convenience.\n\n## Installation\n\nTo install PyIgor, use the following pip command:\n\n```bash\npip install pyigor\n```\n\n## Usage\n\nNote: Ensure Igor Pro is running before executing these commands. If Igor Pro is not already running, the commands will start Igor Pro and pause until the process completes.\n\n### Accessing Igor Pro from Python\n\nHere\u2019s how you can interact with Igor Pro using PyIgor:\n\n```python\nfrom pyigor import Connection\nimport numpy as np\n\n# Establish a connection with Igor Pro\nigor = Connection()\n\n# Send a numpy array to Igor Pro\narray = np.sin(np.linspace(0, 10, 100))\nigor.put(array, \"sinwave\")\n\n# Execute a command in Igor Pro\nigor(\"sinwave += 1\")\n\n# Retrieve a wave from Igor Pro\nwv = igor.get(\"sinwave\")\nprint(wv.array)\n```\n\n### Accessing Python from Igor Pro\n\n#### Preparing Python\n\n```python\nfrom pyigor import Connection\n\n# Establish a connection\nigor = Connection()\n\n# Register a function callable from Igor Pro\n@igor.function \ndef myfunc(a):\n return a * a\n\n# Keep the connection open; not required in interactive mode\nigor.wait_done()\n```\n\nUse the `Connection(security_hole=True)` option to call any Python code from Igor Pro. This setting allows executing Python code through HTTP requests to `http://localhost/code` using `eval(code)`. **Important:** Use this option only if you understand the security implications.\n\n#### Calling Python Functions from Igor Pro\n\nExecute Python functions registered via PyIgor from Igor Pro:\n\n```igorpro\nprint PyIgorCall(\"myfunc(10)\")\n```\n\n## Security Note\n\nWhen enabling `security_hole=True`, ensure your environment is secure and understand the risks associated with executing arbitrary code.\n\n\n\n## Contributors\n\n A special thanks to the people who have contributed to this project:\n\n- [@nlyamada](https://github.com/nlyamada) - Made compatible with Windows\n",
"bugtrack_url": null,
"license": null,
"summary": "Seamlessly integrate Python with WaveMetrics Igor Pro for data and command exchange.",
"version": "0.2.3",
"project_urls": {
"Bug Tracker": "https://github.com/chocolate-icecream/pyigor/issues",
"Homepage": "https://github.com/chocolate-icecream/pyigor"
},
"split_keywords": [
"igor"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "efe0b96b36f28d7bf271639603e709316aa7d4ea5c0adebae6a05b73b1ad649e",
"md5": "9d888ffaff0fb4f0847f70cb48becd0d",
"sha256": "d4b4439780e81329bd0c24e3c6b8649fbf93feb13810689ac84bf79df4cb5d27"
},
"downloads": -1,
"filename": "pyigor-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "9d888ffaff0fb4f0847f70cb48becd0d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 6536,
"upload_time": "2024-07-14T11:53:34",
"upload_time_iso_8601": "2024-07-14T11:53:34.746151Z",
"url": "https://files.pythonhosted.org/packages/ef/e0/b96b36f28d7bf271639603e709316aa7d4ea5c0adebae6a05b73b1ad649e/pyigor-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-14 11:53:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chocolate-icecream",
"github_project": "pyigor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyigor"
}