{"id":26694502,"url":"https://github.com/deeplearnphysics/dlp_opendata_api","last_synced_at":"2025-07-22T01:05:53.976Z","repository":{"id":93947450,"uuid":"166081279","full_name":"DeepLearnPhysics/dlp_opendata_api","owner":"DeepLearnPhysics","description":"APIs for accessing open data set at OSF","archived":false,"fork":false,"pushed_at":"2019-06-21T00:39:16.000Z","size":336,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T18:40:26.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeepLearnPhysics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-16T17:24:33.000Z","updated_at":"2019-06-21T00:39:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"c574a1e5-a974-4816-b095-413543b70342","html_url":"https://github.com/DeepLearnPhysics/dlp_opendata_api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DeepLearnPhysics/dlp_opendata_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLearnPhysics%2Fdlp_opendata_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLearnPhysics%2Fdlp_opendata_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLearnPhysics%2Fdlp_opendata_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLearnPhysics%2Fdlp_opendata_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeepLearnPhysics","download_url":"https://codeload.github.com/DeepLearnPhysics/dlp_opendata_api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLearnPhysics%2Fdlp_opendata_api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266405405,"owners_count":23923536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-26T18:29:53.960Z","updated_at":"2025-07-22T01:05:53.966Z","avatar_url":"https://github.com/DeepLearnPhysics.png","language":"Python","readme":"# Python API\n\nThis package exposes a data API for larcv data\n\nTo use the package, just exectute the following when you start a python session\n```python\nimport sys\nsys.path.append(\"\u003cpath\u003e/dlp_opendata_api\")\n```\nThe main module is `osf`\n\n## Image API\n\nThe image API is in the `osf.image_api` submodule.  A 3D image API is built around a `image_reader_3d` class.\n```python\nfrom osf.image_api import image_reader_3d\n```\n\n**Initialization** The image reader is initialized by providing a file name (or more than one)\n```python\nfname = 'dlprod_ppn_v10/dlprod_192px_00.root'\nimg_reader = image_reader_3d(fname)\n```\n\n**Usage**\n\nSee how many events are in the file:\n```python\nimg_reader.entry_count()\n```\n\nGet energy from event 0:\n```python\nvoxels, energy = img_reader.get_energy(0)\n```\n\nGet classes from event 1:\n```python\nvoxels, classes = img_reader.get_classes(1)\n```\n\nGet energy and classes from event 0:\n```python\nvoxels, energy, classes = img_reader.get_image(0)\n```\n\n\n## Particle API\n\nThe particle API is in the `osf.particle_api` submodule.  \n```python\nfrom osf.particle_api import *\n```\n\n**Initialization** The particle reader is initialized by providing a file name (or more than one)\n```python\nfname = 'dlprod_ppn_v10/particle/dlprod_particle_192px_00.root'\npreader = particle_reader(fname)\n```\n\n**Usage**\n\nSee how many events there are in the file:\n```python\npreader.entry_count()\n```\n\nGet event 0 in the file:\n```python\nevent = preader.get_event(0)\n```\n\nThe event is a dictionary of particle data.  If you want to get an individual particle from the event, use\n```python\np = get_particle(event, 5) # gets particle 5\n```\n\n## Cluster API\n\nThe cluster API is in the `osf.cluster_api` submodule.  \n```python\nfrom osf.cluster_api import *\n```\n\n**Initialization** The cluster reader is initialized by providing a file name (or more than one)\n```python\nfname = 'dlprod_ppn_v10/cluster/dlprod_cluster_192px_00.root'\ncreader = cluster_reader(fname)\n```\n\n**Usage**\n\nSee how many events there are in the file:\n```python\ncreader.entry_count()\n```\n\nGet cluster labels from event:\n```python\neventn = 0\nvoxels, labels= img_reader.get_classes(eventn)\n```\n\n\n## Low-level API\n\nFor some tasks, the high-level APIs above may abstract away too many detatils.  There is also a low-level API that you can use if you know what you're looking for.\n\n**See what's in a file*** \n```python\nfname = 'dlprod_ppn_v10/dlprod_192px_00.root'\nlist_data(fname)\n[out]: ['cluster3d_mcst', 'sparse3d_data', 'sparse3d_fivetypes', 'particle_mcst']\n```\n\n**Data Reader**\nThe `data_reader` class handles the input.\n\nInitialization:\n```python\nreader = data_reader()\n```\nAdd a file to read from:\n```python\nreader.add_file(fname)\n```\nAdd data to read (use `list_data` to see options):\n```python\nreader.add_data('sparse3d_data')\n```\nSee how many entries are available to read:\n```python\nreader.entry_count()\n```\nSet reader pointer to entry `i`\n```python\ni = 0\nreader.read(i)\n```\nGet the actual data (once pointer is set)\n```python\npreader.data('sparse3d_data')\n```\nThere are also several provided parsers, such as\n```python\nparse_sparse3d(preader.data('sparse3d_data'))\n```\n\nThe two high-level APIs use `data_reader` as a base class, so you can also do the above manipulations to `image_reader_3d` and `particle_reader` instances.  However, their purpose is to wrap everything so it is a bit easier to use.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeplearnphysics%2Fdlp_opendata_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeplearnphysics%2Fdlp_opendata_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeplearnphysics%2Fdlp_opendata_api/lists"}