{"id":15043611,"url":"https://github.com/ashirsch/spe2py","last_synced_at":"2025-04-14T23:32:23.046Z","repository":{"id":48577842,"uuid":"61658332","full_name":"ashirsch/spe2py","owner":"ashirsch","description":"Loads Princeton Instruments LightField (SPE 3.0) files into a python environment.","archived":false,"fork":false,"pushed_at":"2021-07-19T20:27:34.000Z","size":6561,"stargazers_count":18,"open_issues_count":6,"forks_count":14,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T22:43:23.620Z","etag":null,"topics":["lightfield","loader","numpy","optics","princeton-instruments","python"],"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/ashirsch.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}},"created_at":"2016-06-21T18:44:25.000Z","updated_at":"2025-03-15T18:51:14.000Z","dependencies_parsed_at":"2022-09-26T20:01:07.344Z","dependency_job_id":null,"html_url":"https://github.com/ashirsch/spe2py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashirsch%2Fspe2py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashirsch%2Fspe2py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashirsch%2Fspe2py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashirsch%2Fspe2py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashirsch","download_url":"https://codeload.github.com/ashirsch/spe2py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248979094,"owners_count":21192901,"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":["lightfield","loader","numpy","optics","princeton-instruments","python"],"created_at":"2024-09-24T20:49:20.452Z","updated_at":"2025-04-14T23:32:20.552Z","avatar_url":"https://github.com/ashirsch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spe2py\n\nspe2py is a module that imports a Princeton Instruments LightField (SPE 3.x) file into a python environment. \n\n### Basic Usage\n##### Loading and accessing data\nUse the `load()` function to load one or more SPE files at a time:\n```python\n\u003e\u003e\u003e import spe2py as spe\n\u003e\u003e\u003e loaded_files = spe.load()\n```\nA file selection window will open to allow browsing for source files. The result is an individual SpeFile object, or, in the case where multiple files are loaded at once, a list of SpeFile objects.\n\nRaw data from a file is stored in NumPy arrays and can be accessed directly by\n```python\n\u003e\u003e\u003e frame_data = loaded_files.data[frame][regionOfInterest]  \n\u003e\u003e\u003e frame_data = loaded_files[n].data[frame][regionOfInterest]  # where multiple files are loaded\n```\nAlternatively one can load an individual file by passing `SpeFile()` the source path directly:\n```python\nfile_object = spe.SpeFile(path)\n# is equivalent to...\nfile_object = spe.load()  # and selecting the same file/path\n```\n\n\n##### Automatic imaging and plotting\nTo quickly view an individual frame, region-of-interest, or spectrum, use the `image()` or `specplot()` methods. For example,\n```python\n\u003e\u003e\u003e loaded_file.image()  # images the first frame and region of interest\n\u003e\u003e\u003e loaded_file.image(f, r)  # images frame 'f' and region of interest 'r'\n\u003e\u003e\u003e loaded_file.specplot()  # plots the loaded spectrum\n```\n\n##### Accessing metadata\nUpon loading, the metadata contained in the file's XML footer is automatically parsed and stored as an `untangle` object in the `footer` variable. Elements and attributes can be accessed by calling the different elements and subelements of footer, ending with the attribute as a string:\n```python\n\u003e\u003e\u003e sensor_height = loaded_file.footer.SpeFormat.Calibrations.SensorInformation['height']\n```\nOne can print the full element tree by calling the `xmltree()` method.\n\n### Dependencies\n  - NumPy - data storage and file reading\n  - tkinter - file selection dialog\n  - matplotlib - imaging and plotting\n  - [untangle](https://github.com/stchris/untangle) - XML parsing\n\n### Version\n1.0.0a - initial upload\n\n\nLicense\n----\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashirsch%2Fspe2py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashirsch%2Fspe2py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashirsch%2Fspe2py/lists"}