{"id":21602905,"url":"https://github.com/dials/nxmx","last_synced_at":"2025-03-18T13:36:48.438Z","repository":{"id":149673284,"uuid":"558800299","full_name":"dials/nxmx","owner":"dials","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-05T14:23:54.000Z","size":107,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-05T15:28:48.527Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dials.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":"2022-10-28T10:24:04.000Z","updated_at":"2025-03-05T14:23:57.000Z","dependencies_parsed_at":"2024-11-24T19:14:41.847Z","dependency_job_id":"addf136a-3e97-46b9-9232-154d2795b8b2","html_url":"https://github.com/dials/nxmx","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dials%2Fnxmx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dials%2Fnxmx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dials%2Fnxmx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dials%2Fnxmx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dials","download_url":"https://codeload.github.com/dials/nxmx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244232384,"owners_count":20420089,"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","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":"2024-11-24T19:14:38.725Z","updated_at":"2025-03-18T13:36:48.415Z","avatar_url":"https://github.com/dials.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Read NXmx-flavour NeXus HDF5 data in Python\n\n[![PyPI release](https://img.shields.io/pypi/v/nxmx.svg)](https://pypi.python.org/pypi/nxmx)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/nxmx.svg)](https://pypi.org/project/nxmx)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)]( https://github.com/ambv/black)\n\nThis package provides a neat and tidy Python interface for reading data from [HDF5 files](https://www.hdfgroup.org/solutions/hdf5/) that are structured according to the [NXmx application definition](https://manual.nexusformat.org/classes/applications/NXmx.html) of the [NeXus standard](https://www.nexusformat.org/).\n\n## Installation\n`python-nxmx` is available as `nxmx` on PyPI, so you just need Pip.\n```Bash\n$ pip install nxmx\n```\n\n## Getting started\n\nIf you have an HDF5 file in NXmx format, inspecting it with `h5ls` will look something like this:\n```Bash\n$ h5ls -r my-nxmx-file.h5 \n/                        Group\n/entry                   Group\n/entry/data              Group\n/entry/definition        Dataset {SCALAR}\n/entry/end_time          Dataset {SCALAR}\n/entry/end_time_estimated Dataset {SCALAR}\n/entry/instrument        Group\n/entry/instrument/beam   Group\n/entry/instrument/beam/incident_beam_size Dataset {2}\n/entry/instrument/beam/incident_wavelength Dataset {SCALAR}\n/entry/instrument/beam/total_flux Dataset {SCALAR}\n/entry/instrument/detector Group\n\n... etc. ...\n```\nWith `nxmx`, you can access the NXmx data in Python like this:\n```Python\nimport h5py\nimport nxmx\n\nwith h5py.File(\"my-nxmx-file.h5\") as f:\n    nxmx_data = nxmx.NXmx(f)\n```\n\n## A slightly more detailed example\n```Python\nimport h5py\nimport nxmx\n\nwith h5py.File(\"my-nxmx-file.h5\") as f:\n    nxmx_data = nxmx.NXmx(f)\n    # Explore the NXmx data structure.\n    entry, *_ = nxmx_data.entries\n    print(entry.definition)  # Prints \"NXmx\".\n    instrument, *_ = entry.instruments\n    detector, *_ = instrument.detectors\n    \n    # Get the h5py object underlying an instance of a NX class.\n    entry_group = entry._handle  # entry_group == f[\"entry\"]\n\n    # Find instances of a given NX class in a h5py.Group.\n    beams = nxmx.find_class(instrument._handle, \"NXbeam\")\n    # The equivalent for more than one NX class.\n    beams, detectors = nxmx.find_classes(instrument._handle, \"NXbeam\", \"NXdetector\")\n\n    # Query attributes of an object in the normal h5py way.\n    # Suppose out detector has a transformation called \"det_z\".\n    transformations, *_ = nxmx.find_class(detector._handle, \"NXtransformations\")\n    attrs = transformations[\"det_z\"].attrs  # Get the attributes of the \"det_z\" dataset.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdials%2Fnxmx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdials%2Fnxmx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdials%2Fnxmx/lists"}