mat2py


Namemat2py JSON
Version 0.0.22 PyPI version JSON
download
home_pagehttps://mat2py.org
Summarymat2py mean to be drop-in replacement of Matlab by wrapping Numpy/Scipy/... packages.
upload_time2023-10-29 12:26:36
maintainer
docs_urlNone
authormat2py
requires_python>=3.7,<4
licenseMIT
keywords matlab python numpy scipy
VCS
bugtrack_url
requirements executing importlib-metadata numpy numpy scipy scipy typing-extensions zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mat2py

<div align="center">

[![Build status](https://github.com/mat2py/mat2py/workflows/build/badge.svg?branch=master&event=push)](https://github.com/mat2py/mat2py/actions?query=workflow%3Abuild)
[![Python Version](https://img.shields.io/pypi/pyversions/mat2py.svg)](https://pypi.org/project/mat2py/)
[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/mat2py/mat2py/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)
[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/mat2py/mat2py/blob/master/.pre-commit-config.yaml)
[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/mat2py/mat2py/releases)
[![License](https://img.shields.io/github/license/mat2py/mat2py)](https://github.com/mat2py/mat2py/blob/master/LICENSE)
![Coverage Report](assets/images/coverage.svg)

mat2py mean to be drop-in replacement of Matlab by wrapping Numpy/Scipy/... packages.

</div>

For instance usage, try the *Online Matlab Emulator* [here](https://console.mat2py.org/). 
Please note:
- You may need the latest modern browser for using this APP(check the console log by pressing F12).
- Loading the environment may take quite long time, especially for the first time. Try refresh the page incase bad network connection.
- Do a feature request when encounter `NotImplementedError`.

![Coverage Report](assets/images/console.png)

Try copy-paste following code to the emulator and feel its capability:

```matlab
xv = [0.5;0.2;1.0;0;0.8;0.5];
yv = [1.0;0.1;0.7;0.7;0.1;1];
xq = [0.1;0.5;0.9;0.2;0.4;0.5;0.5;0.9;0.6;0.8;0.7;0.2];
yq = [0.4;0.6;0.9;0.7;0.3;0.8;0.2;0.4;0.4;0.6;0.2;0.6];

[in,on] = inpolygon(xq,yq,xv,yv);

plot(xv,yv, ... % polygon
     xq(in&~on),yq(in&~on),'r+', ...  % points strictly inside
     xq(on),yq(on),'k*', ... % points on edge
     xq(~in),yq(~in),'bo' ... % points outside
)
```

The final goal of this APP is to create a **serverless**, **Matlab compatiable** console completely in end-users' browser.

## First Steps

### Installation

```bash
python3 -m pip install -U mat2py
```

or install with `Poetry`

```bash
poetry add mat2py
```

### Install the translator `mh_python` if needed
```bash
python3 -m pip install -U mh-python
```

### Try the example `demo_fft`

```bash
# download the one already converted and formatted
wget https://raw.githubusercontent.com/mat2py/mat2py/main/examples/demo_fft.py

# or convert it yourself
echo "wget https://raw.githubusercontent.com/mat2py/mat2py/main/examples/demo_fft.m"
echo "mh_python --python-alongside --format demo_fft.m"

# run it...
python3 demo_fft.py
```

You can also **try out** the [online translator](https://translate.mat2py.org/) by modifiy the example or put your own code.

## For Developer

### Initialize your code

1. Clone `mat2py`:

```bash
git clone https://github.com/mat2py/mat2py 
```

2. If you don't have `Poetry` installed run:

```bash
make poetry-download
source ~/.poetry/env
```

3. Initialize poetry and install `pre-commit` hooks:

```bash
make install
make pre-commit-install
```

4. Run the lint to check:

```bash
make lint
```

## ToDO

- A serverless web service for run `.m`/`.py` code inside browser
- Complete set of [MATLAB® Basic Functions](https://www.mathworks.com/content/dam/mathworks/fact-sheet/matlab-basic-functions-reference.pdf)
- Copy-on-Write beheviour
- A cleaner class hierarchy
- Enable `lint`(mypy, UT, etc.)

## 📈 Releases

You can see the list of available releases on the [GitHub Releases](https://github.com/mat2py/mat2py/releases) page.

We follow [Semantic Versions](https://semver.org/) specification.

We use [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.

## 🛡 License

[![License](https://img.shields.io/github/license/mat2py/mat2py)](https://github.com/mat2py/mat2py/blob/master/LICENSE)

This project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/mat2py/mat2py/blob/master/LICENSE) for more details.

## 📃 Citation

```bibtex
@misc{mat2py,
  author = {mat2py},
  title = {mat2py mean to be drop-in replacement of Matlab by wrapping Numpy/Scipy/... packages.},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/mat2py/mat2py}}
}
```

## Credits [![🚀 Your next Python package needs a bleeding-edge project structure.](https://img.shields.io/badge/python--package--template-%F0%9F%9A%80-brightgreen)](https://github.com/TezRomacH/python-package-template)

- This project was initially generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template)
- The Matlab to Python translator `mh_python` is developed under fork of [MISS HIT](https://github.com/florianschanda/miss_hit), a fantastic Matlab static analysis tool.
- The [serverless console](https://console.mat2py.org/) is created based on [Pyodide](https://pyodide.org/).


            

Raw data

            {
    "_id": null,
    "home_page": "https://mat2py.org",
    "name": "mat2py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4",
    "maintainer_email": "",
    "keywords": "Matlab,Python,Numpy,Scipy",
    "author": "mat2py",
    "author_email": "chaoqingwang.nick@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cc/ca/94526a9eb024a4e104fb6945b6c16e80358b7ca761c5dfa1244f9f82f4fe/mat2py-0.0.22.tar.gz",
    "platform": null,
    "description": "# mat2py\n\n<div align=\"center\">\n\n[![Build status](https://github.com/mat2py/mat2py/workflows/build/badge.svg?branch=master&event=push)](https://github.com/mat2py/mat2py/actions?query=workflow%3Abuild)\n[![Python Version](https://img.shields.io/pypi/pyversions/mat2py.svg)](https://pypi.org/project/mat2py/)\n[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/mat2py/mat2py/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)\n[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/mat2py/mat2py/blob/master/.pre-commit-config.yaml)\n[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/mat2py/mat2py/releases)\n[![License](https://img.shields.io/github/license/mat2py/mat2py)](https://github.com/mat2py/mat2py/blob/master/LICENSE)\n![Coverage Report](assets/images/coverage.svg)\n\nmat2py mean to be drop-in replacement of Matlab by wrapping Numpy/Scipy/... packages.\n\n</div>\n\nFor instance usage, try the *Online Matlab Emulator* [here](https://console.mat2py.org/). \nPlease note:\n- You may need the latest modern browser for using this APP(check the console log by pressing F12).\n- Loading the environment may take quite long time, especially for the first time. Try refresh the page incase bad network connection.\n- Do a feature request when encounter `NotImplementedError`.\n\n![Coverage Report](assets/images/console.png)\n\nTry copy-paste following code to the emulator and feel its capability:\n\n```matlab\nxv = [0.5;0.2;1.0;0;0.8;0.5];\nyv = [1.0;0.1;0.7;0.7;0.1;1];\nxq = [0.1;0.5;0.9;0.2;0.4;0.5;0.5;0.9;0.6;0.8;0.7;0.2];\nyq = [0.4;0.6;0.9;0.7;0.3;0.8;0.2;0.4;0.4;0.6;0.2;0.6];\n\n[in,on] = inpolygon(xq,yq,xv,yv);\n\nplot(xv,yv, ... % polygon\n     xq(in&~on),yq(in&~on),'r+', ...  % points strictly inside\n     xq(on),yq(on),'k*', ... % points on edge\n     xq(~in),yq(~in),'bo' ... % points outside\n)\n```\n\nThe final goal of this APP is to create a **serverless**, **Matlab compatiable** console completely in end-users' browser.\n\n## First Steps\n\n### Installation\n\n```bash\npython3 -m pip install -U mat2py\n```\n\nor install with `Poetry`\n\n```bash\npoetry add mat2py\n```\n\n### Install the translator `mh_python` if needed\n```bash\npython3 -m pip install -U mh-python\n```\n\n### Try the example `demo_fft`\n\n```bash\n# download the one already converted and formatted\nwget https://raw.githubusercontent.com/mat2py/mat2py/main/examples/demo_fft.py\n\n# or convert it yourself\necho \"wget https://raw.githubusercontent.com/mat2py/mat2py/main/examples/demo_fft.m\"\necho \"mh_python --python-alongside --format demo_fft.m\"\n\n# run it...\npython3 demo_fft.py\n```\n\nYou can also **try out** the [online translator](https://translate.mat2py.org/) by modifiy the example or put your own code.\n\n## For Developer\n\n### Initialize your code\n\n1. Clone `mat2py`:\n\n```bash\ngit clone https://github.com/mat2py/mat2py \n```\n\n2. If you don't have `Poetry` installed run:\n\n```bash\nmake poetry-download\nsource ~/.poetry/env\n```\n\n3. Initialize poetry and install `pre-commit` hooks:\n\n```bash\nmake install\nmake pre-commit-install\n```\n\n4. Run the lint to check:\n\n```bash\nmake lint\n```\n\n## ToDO\n\n- A serverless web service for run `.m`/`.py` code inside browser\n- Complete set of [MATLAB\u00ae Basic Functions](https://www.mathworks.com/content/dam/mathworks/fact-sheet/matlab-basic-functions-reference.pdf)\n- Copy-on-Write beheviour\n- A cleaner class hierarchy\n- Enable `lint`(mypy, UT, etc.)\n\n## \ud83d\udcc8 Releases\n\nYou can see the list of available releases on the [GitHub Releases](https://github.com/mat2py/mat2py/releases) page.\n\nWe follow [Semantic Versions](https://semver.org/) specification.\n\nWe use [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you\u2019re ready. With the categories option, you can categorize pull requests in release notes using labels.\n\n## \ud83d\udee1 License\n\n[![License](https://img.shields.io/github/license/mat2py/mat2py)](https://github.com/mat2py/mat2py/blob/master/LICENSE)\n\nThis project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/mat2py/mat2py/blob/master/LICENSE) for more details.\n\n## \ud83d\udcc3 Citation\n\n```bibtex\n@misc{mat2py,\n  author = {mat2py},\n  title = {mat2py mean to be drop-in replacement of Matlab by wrapping Numpy/Scipy/... packages.},\n  year = {2021},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/mat2py/mat2py}}\n}\n```\n\n## Credits [![\ud83d\ude80 Your next Python package needs a bleeding-edge project structure.](https://img.shields.io/badge/python--package--template-%F0%9F%9A%80-brightgreen)](https://github.com/TezRomacH/python-package-template)\n\n- This project was initially generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template)\n- The Matlab to Python translator `mh_python` is developed under fork of [MISS HIT](https://github.com/florianschanda/miss_hit), a fantastic Matlab static analysis tool.\n- The [serverless console](https://console.mat2py.org/) is created based on [Pyodide](https://pyodide.org/).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "mat2py mean to be drop-in replacement of Matlab by wrapping Numpy/Scipy/... packages.",
    "version": "0.0.22",
    "project_urls": {
        "Homepage": "https://mat2py.org",
        "Repository": "https://github.com/mat2py/mat2py"
    },
    "split_keywords": [
        "matlab",
        "python",
        "numpy",
        "scipy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16e8f56fac10ce93ca59ece08ee2edf9e9f7a2770bbd53afcd28e7246e116d97",
                "md5": "57df75f9be57cb2a9ff05d8219a0cd73",
                "sha256": "0878f95f036c6c24f01ffef1f4dc72f5058dd5de762a3431df83084ee90cb1cc"
            },
            "downloads": -1,
            "filename": "mat2py-0.0.22-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "57df75f9be57cb2a9ff05d8219a0cd73",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4",
            "size": 61199,
            "upload_time": "2023-10-29T12:26:34",
            "upload_time_iso_8601": "2023-10-29T12:26:34.773367Z",
            "url": "https://files.pythonhosted.org/packages/16/e8/f56fac10ce93ca59ece08ee2edf9e9f7a2770bbd53afcd28e7246e116d97/mat2py-0.0.22-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ccca94526a9eb024a4e104fb6945b6c16e80358b7ca761c5dfa1244f9f82f4fe",
                "md5": "bf12a5bbc301648ef58e050cb2a0712b",
                "sha256": "eda39cd01a525c12e70677690f2f580aeacdfa140657c619f1fe9163b092ecf7"
            },
            "downloads": -1,
            "filename": "mat2py-0.0.22.tar.gz",
            "has_sig": false,
            "md5_digest": "bf12a5bbc301648ef58e050cb2a0712b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4",
            "size": 49875,
            "upload_time": "2023-10-29T12:26:36",
            "upload_time_iso_8601": "2023-10-29T12:26:36.743570Z",
            "url": "https://files.pythonhosted.org/packages/cc/ca/94526a9eb024a4e104fb6945b6c16e80358b7ca761c5dfa1244f9f82f4fe/mat2py-0.0.22.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-29 12:26:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mat2py",
    "github_project": "mat2py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "executing",
            "specs": [
                [
                    "==",
                    "0.8.3"
                ]
            ]
        },
        {
            "name": "importlib-metadata",
            "specs": [
                [
                    "==",
                    "4.13.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.21.6"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.24.4"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    "==",
                    "1.7.3"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    "==",
                    "1.9.3"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.7.1"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.15.0"
                ]
            ]
        }
    ],
    "lcname": "mat2py"
}
        
Elapsed time: 2.27089s