modgraph


Namemodgraph JSON
Version 0.2.2 PyPI version JSON
download
home_page
Summarya tool to analyze sample overlap between tracker module files
upload_time2022-12-22 14:01:34
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT
keywords tracker music samples
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `modgraph`

`modgraph` is a tool to explore a collection of tracker <i>mod</i>ule files as a module->sample _graph_.
It can function both as a CLI app, and as a library to use in notebooks.
In fact, this file is a [notebook](README.ipynb)!

## Using through CLI


```python
!python -m modgraph --help
```

    usage: modgraph [-h] [-f {csv,d2}] [-r RANK] files [files ...]
    
    positional arguments:
      files                 module files to analyze
    
    options:
      -h, --help            show this help message and exit
      -f {csv,d2}, --format {csv,d2}
                            output format
      -r RANK, --rank RANK  min number of repeats for sample to be included


### Example:


```python
!python -m modgraph *.it --rank 6 --format csv
```

    mod_path,sample_name,sample_hash
    catherine on the waves.it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5
    catherine on the waves.it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3
    dallying sadly in space.it,                          ,e1b32f84b2b788f0a58e277f4e152df5
    drifting to plutonia.it,tambourine.steel.quiet    ,e1b32f84b2b788f0a58e277f4e152df5
    heavenly fantasy.it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5
    neverending illusion.it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3
    "so close to you, my angel.it",piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3
    sorrow.it,                          ,8ef52cdf9c20c9ada9df7bf4d3b59fc3
    sylvia.it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3
    tender storm.it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5
    why (enhanced version).it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3
    why (enhanced version).it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5


## Using as a library


```python
import pandas as pd
from modgraph import modgraph
from glob import glob

# digest your library into a mod_path -> sample_hash mapping
df = pd.DataFrame(modgraph(glob("*.it")))
df = df.set_index(['mod_path', 'sample_hash']).sort_index()
df
```




<div>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th></th>
      <th>sample_name</th>
    </tr>
    <tr>
      <th>mod_path</th>
      <th>sample_hash</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th rowspan="5" valign="top">a day at the river.it</th>
      <th>13dc761472f1e73cff4ed428be35a5c2</th>
      <td>SoundWave.HiQual</td>
    </tr>
    <tr>
      <th>29797bec77f15b782ee0d8f855720213</th>
      <td>rimshot</td>
    </tr>
    <tr>
      <th>3e741972e4147bfc395467a293bb11a4</th>
      <td>Flute (Skaven)</td>
    </tr>
    <tr>
      <th>46a82c17348315db0ec7d4558fb4a9e9</th>
      <td>fx.750</td>
    </tr>
    <tr>
      <th>6ce9cd4d2bd435dc6b410b4bc65eab2d</th>
      <td>river.wav (Eagle)</td>
    </tr>
    <tr>
      <th>...</th>
      <th>...</th>
      <td>...</td>
    </tr>
    <tr>
      <th rowspan="5" valign="top">why (enhanced version).it</th>
      <th>d9d2074594be1e44cebafdc840c84b94</th>
      <td>DX-Strings 1</td>
    </tr>
    <tr>
      <th>dcacd358eb1c8a23027d1dad35e44726</th>
      <td>osterm1bass1</td>
    </tr>
    <tr>
      <th>e1b32f84b2b788f0a58e277f4e152df5</th>
      <td>tambourin.steel.quiet</td>
    </tr>
    <tr>
      <th>e4f1c0e5019b51ff947d0966eeac29f8</th>
      <td>electric.guitar.solo1</td>
    </tr>
    <tr>
      <th>f8d42ab1418cdbf77a53355b600fc7fe</th>
      <td>bassdrum.459</td>
    </tr>
  </tbody>
</table>
<p>216 rows × 1 columns</p>
</div>




```python
def most_used(df, cutoff):
    df = df.groupby("sample_hash")
    df = df.agg({"sample_name": [("name", lambda g: g.mode()[0]), "count"]})
    df = df.sort_values(("sample_name", "count"), ascending=False)
    df = df[df[("sample_name", "count")] >= cutoff]
    return df

most_used(df, cutoff=3).plot(kind="barh", x=('sample_name', 'name'))
```




    <AxesSubplot: ylabel='(sample_name, name)'>




    
![png](README_files/README_7_1.png)
    


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "modgraph",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "tracker,music,samples",
    "author": "",
    "author_email": "Ilia Pozdnyakov <ilia.pozdnyakov@ya.ru>",
    "download_url": "https://files.pythonhosted.org/packages/da/ec/170a880a060f65734cf549728baf3cb476a8c9035c2105ce53aeca8a5c25/modgraph-0.2.2.tar.gz",
    "platform": null,
    "description": "# `modgraph`\n\n`modgraph` is a tool to explore a collection of tracker <i>mod</i>ule files as a module->sample _graph_.\nIt can function both as a CLI app, and as a library to use in notebooks.\nIn fact, this file is a [notebook](README.ipynb)!\n\n## Using through CLI\n\n\n```python\n!python -m modgraph --help\n```\n\n    usage: modgraph [-h] [-f {csv,d2}] [-r RANK] files [files ...]\n    \n    positional arguments:\n      files                 module files to analyze\n    \n    options:\n      -h, --help            show this help message and exit\n      -f {csv,d2}, --format {csv,d2}\n                            output format\n      -r RANK, --rank RANK  min number of repeats for sample to be included\n\n\n### Example:\n\n\n```python\n!python -m modgraph *.it --rank 6 --format csv\n```\n\n    mod_path,sample_name,sample_hash\n    catherine on the waves.it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5\n    catherine on the waves.it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3\n    dallying sadly in space.it,                          ,e1b32f84b2b788f0a58e277f4e152df5\n    drifting to plutonia.it,tambourine.steel.quiet    ,e1b32f84b2b788f0a58e277f4e152df5\n    heavenly fantasy.it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5\n    neverending illusion.it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3\n    \"so close to you, my angel.it\",piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3\n    sorrow.it,                          ,8ef52cdf9c20c9ada9df7bf4d3b59fc3\n    sylvia.it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3\n    tender storm.it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5\n    why (enhanced version).it,piano.001                 ,8ef52cdf9c20c9ada9df7bf4d3b59fc3\n    why (enhanced version).it,tambourin.steel.quiet     ,e1b32f84b2b788f0a58e277f4e152df5\n\n\n## Using as a library\n\n\n```python\nimport pandas as pd\nfrom modgraph import modgraph\nfrom glob import glob\n\n# digest your library into a mod_path -> sample_hash mapping\ndf = pd.DataFrame(modgraph(glob(\"*.it\")))\ndf = df.set_index(['mod_path', 'sample_hash']).sort_index()\ndf\n```\n\n\n\n\n<div>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th></th>\n      <th>sample_name</th>\n    </tr>\n    <tr>\n      <th>mod_path</th>\n      <th>sample_hash</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">a day at the river.it</th>\n      <th>13dc761472f1e73cff4ed428be35a5c2</th>\n      <td>SoundWave.HiQual</td>\n    </tr>\n    <tr>\n      <th>29797bec77f15b782ee0d8f855720213</th>\n      <td>rimshot</td>\n    </tr>\n    <tr>\n      <th>3e741972e4147bfc395467a293bb11a4</th>\n      <td>Flute (Skaven)</td>\n    </tr>\n    <tr>\n      <th>46a82c17348315db0ec7d4558fb4a9e9</th>\n      <td>fx.750</td>\n    </tr>\n    <tr>\n      <th>6ce9cd4d2bd435dc6b410b4bc65eab2d</th>\n      <td>river.wav (Eagle)</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <th>...</th>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">why (enhanced version).it</th>\n      <th>d9d2074594be1e44cebafdc840c84b94</th>\n      <td>DX-Strings 1</td>\n    </tr>\n    <tr>\n      <th>dcacd358eb1c8a23027d1dad35e44726</th>\n      <td>osterm1bass1</td>\n    </tr>\n    <tr>\n      <th>e1b32f84b2b788f0a58e277f4e152df5</th>\n      <td>tambourin.steel.quiet</td>\n    </tr>\n    <tr>\n      <th>e4f1c0e5019b51ff947d0966eeac29f8</th>\n      <td>electric.guitar.solo1</td>\n    </tr>\n    <tr>\n      <th>f8d42ab1418cdbf77a53355b600fc7fe</th>\n      <td>bassdrum.459</td>\n    </tr>\n  </tbody>\n</table>\n<p>216 rows \u00d7 1 columns</p>\n</div>\n\n\n\n\n```python\ndef most_used(df, cutoff):\n    df = df.groupby(\"sample_hash\")\n    df = df.agg({\"sample_name\": [(\"name\", lambda g: g.mode()[0]), \"count\"]})\n    df = df.sort_values((\"sample_name\", \"count\"), ascending=False)\n    df = df[df[(\"sample_name\", \"count\")] >= cutoff]\n    return df\n\nmost_used(df, cutoff=3).plot(kind=\"barh\", x=('sample_name', 'name'))\n```\n\n\n\n\n    <AxesSubplot: ylabel='(sample_name, name)'>\n\n\n\n\n    \n![png](README_files/README_7_1.png)\n    \n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "a tool to analyze sample overlap between tracker module files",
    "version": "0.2.2",
    "split_keywords": [
        "tracker",
        "music",
        "samples"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b9aaa9bf198741345aaea0c262394796",
                "sha256": "fa2561cd0efa25d4d3c515a89e1422aaf6d8394998350ece7fb14f63a458a186"
            },
            "downloads": -1,
            "filename": "modgraph-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9aaa9bf198741345aaea0c262394796",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 5549,
            "upload_time": "2022-12-22T14:01:33",
            "upload_time_iso_8601": "2022-12-22T14:01:33.278190Z",
            "url": "https://files.pythonhosted.org/packages/26/11/ac816785593a8497d0cdacfad9c5d8b7e7cac6b3f8e2deea21181a53d574/modgraph-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "457f4e3351e7402cdd2dfb1a068bb459",
                "sha256": "0761997b7c4af3e54b481c0191f9155e61507965f51b0618c4e2a2ee52a830be"
            },
            "downloads": -1,
            "filename": "modgraph-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "457f4e3351e7402cdd2dfb1a068bb459",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5256,
            "upload_time": "2022-12-22T14:01:34",
            "upload_time_iso_8601": "2022-12-22T14:01:34.734573Z",
            "url": "https://files.pythonhosted.org/packages/da/ec/170a880a060f65734cf549728baf3cb476a8c9035c2105ce53aeca8a5c25/modgraph-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-22 14:01:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "modgraph"
}
        
Elapsed time: 0.05113s