brimfile 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ name: docs_pages
2
+
3
+ # build the documentation whenever there are new commits on main
4
+ on:
5
+ push:
6
+ branches:
7
+ - main
8
+ # Alternative: only build for tags.
9
+ # tags:
10
+ # - '*'
11
+
12
+ # security: restrict permissions for CI jobs.
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ # Build the documentation and upload the static HTML files as an artifact.
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ persist-credentials: false
24
+ - uses: actions/setup-python@v5
25
+ with:
26
+ python-version: '3.13'
27
+
28
+ # ADJUST THIS: install all dependencies (including pdoc)
29
+ - run: pip install numpy
30
+ - run: pip install "zarr>=3"
31
+ - run: pip install -e .
32
+ - run: pip install pdoc
33
+ # ADJUST THIS: build your documentation into docs/.
34
+ # We use a custom build script for pdoc itself, ideally you just run `pdoc -o docs/ ...` here.
35
+ - run: pdoc src/brimfile -o docs
36
+
37
+ - uses: actions/upload-pages-artifact@v3
38
+ with:
39
+ path: docs/
40
+
41
+ # Deploy the artifact to GitHub pages.
42
+ # This is a separate job so that only actions/deploy-pages has the necessary permissions.
43
+ deploy:
44
+ needs: build
45
+ runs-on: ubuntu-latest
46
+ permissions:
47
+ pages: write
48
+ id-token: write
49
+ environment:
50
+ name: github-pages
51
+ url: ${{ steps.deployment.outputs.page_url }}
52
+ steps:
53
+ - id: deployment
54
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,4 @@
1
+ .venv/
2
+ .DS_Store
3
+ src/brimfile/__pycache__/*
4
+ dist/*
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: brimfile
3
+ Version: 1.0.0
4
+ Summary: A package to read and write to the brim file format, containing spectral data and metadata from Brillouin microscopy
5
+ Project-URL: Documentation, https://prevedel-lab.github.io/brimfile/
6
+ Project-URL: Repository, https://github.com/prevedel-lab/brimfile
7
+ Project-URL: Issues, https://github.com/prevedel-lab/brimfile/issues
8
+ Author-email: Carlo Bevilacqua <carlo.bevilacqua@embl.de>, Sebastian Hambura <sebastian.hambura@embl.de>
9
+ License-Expression: LGPL-3.0-or-later
10
+ License-File: LICENSE.toml
11
+ Keywords: Brillouin microscopy
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: File Formats
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Requires-Dist: numpy
19
+ Requires-Dist: zarr>=3.0
20
+ Provides-Extra: export-tiff
21
+ Requires-Dist: tifffile; extra == 'export-tiff'
22
+ Provides-Extra: remote-store
23
+ Requires-Dist: fsspec; extra == 'remote-store'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # brimfile package
27
+
28
+ ## What is it?
29
+
30
+ *brimfile* is a package to read and write to brim (**Br**illouin **im**aging) files, containing spectral data and metadata from Brillouin microscopy.
31
+
32
+ The detailed specs of the brim file format can be found [here](https://github.com/prevedel-lab/Brillouin-standard-file/blob/main/docs/brim_file_specs.md).
33
+
34
+ ## Where to get it
35
+
36
+ *brimfile* can be installed from PyPI using `pip`:
37
+ ```bash
38
+ pip install brimfile
39
+ ```
40
+
41
+ ## How to use it
42
+
43
+ The documentation of the package can be found [here](https://prevedel-lab.github.io/brimfile/).
@@ -0,0 +1,18 @@
1
+ # brimfile package
2
+
3
+ ## What is it?
4
+
5
+ *brimfile* is a package to read and write to brim (**Br**illouin **im**aging) files, containing spectral data and metadata from Brillouin microscopy.
6
+
7
+ The detailed specs of the brim file format can be found [here](https://github.com/prevedel-lab/Brillouin-standard-file/blob/main/docs/brim_file_specs.md).
8
+
9
+ ## Where to get it
10
+
11
+ *brimfile* can be installed from PyPI using `pip`:
12
+ ```bash
13
+ pip install brimfile
14
+ ```
15
+
16
+ ## How to use it
17
+
18
+ The documentation of the package can be found [here](https://prevedel-lab.github.io/brimfile/).
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.26"]
3
+ build-backend = "hatchling.build"
4
+ [tool.hatch.version]
5
+ path = "src/brimfile/__init__.py"
6
+
7
+ [project]
8
+ name = "brimfile"
9
+ dynamic = ["version"]
10
+ authors = [
11
+ {name = "Carlo Bevilacqua", email = "carlo.bevilacqua@embl.de"},
12
+ {name = "Sebastian Hambura", email = "sebastian.hambura@embl.de"},
13
+ ]
14
+ description = "A package to read and write to the brim file format, containing spectral data and metadata from Brillouin microscopy"
15
+ readme = "README.md"
16
+ license = "LGPL-3.0-or-later"
17
+ license-files = ["LICEN[CS]E*"]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Science/Research",
21
+ "Intended Audience :: Developers",
22
+ "Topic :: File Formats",
23
+ "Topic :: Scientific/Engineering",
24
+ "Programming Language :: Python :: 3"
25
+
26
+ ]
27
+ keywords = ["Brillouin microscopy"]
28
+ dependencies = [
29
+ "numpy",
30
+ "zarr >= 3.0"
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ remote-store = ["fsspec"]
35
+ export-tiff = ["tifffile"]
36
+
37
+ [project.urls]
38
+ Documentation = "https://prevedel-lab.github.io/brimfile/"
39
+ Repository = "https://github.com/prevedel-lab/brimfile"
40
+ Issues = "https://github.com/prevedel-lab/brimfile/issues"
@@ -0,0 +1,275 @@
1
+ """
2
+ ## What is brimfile?
3
+
4
+ *brimfile* is a Python library to read from and write to brim files,
5
+ which contain both the spectra and analysed data for Brillouin imaging.
6
+ More information about the brim file format can be found [here](https://github.com/prevedel-lab/Brillouin-standard-file).
7
+
8
+ Briefly, a brim file can contain multiple data groups,
9
+ typically corresponding to imaging of the same sample at different timepoints/conditions.
10
+ Each data group contains the spectral data as well as the metadata and
11
+ the results of the analysis on the spectral data (which can be many in case multiple reconstruction pipelines are performed).
12
+
13
+ The structure of the *brimfile* library reflects the structure of the brim file and the user can access the data,
14
+ metadata and analysis results through their corresponding classes.
15
+
16
+ - [File](#file): represents a brim file, which can be opened or created.
17
+ - [Data](#data): represents a data group in the brim file, which contains the spectral data and metadata.
18
+ - [Metadata](#metadata): represents the metadata associated to a data group (or to the whole file).
19
+ - [AnalysysResults](#analysisresults): represents the results of the analysis of the spectral data.
20
+
21
+
22
+ ## Install brimfile
23
+
24
+ Simply run:
25
+
26
+ ```bash
27
+ pip install brimfile
28
+ ```
29
+
30
+ If you also need the support for exporting the analyzed data to OME-Tiff files,
31
+ you can install the optional dependencies with:
32
+
33
+ ```bash
34
+ pip install brimfile[export-tiff]
35
+ ```
36
+
37
+
38
+ ## Use brimfile
39
+
40
+ ### File
41
+
42
+ The main class is `brimfile.file.File`, which represents a brim file.
43
+ It can be used to create a new brim file (`brimfile.file.File.create`) or to open an existing one (`brimfile.file.File.__init__`).
44
+
45
+ ```Python
46
+ import brimfile as brim
47
+
48
+ filename = 'path/to/your/file.brim.zip'
49
+
50
+ # Open an existing brim file
51
+ f = brim.File(filename)
52
+
53
+ # or create a new one
54
+ f = brim.File.create(filename, store_type='zip')
55
+ ```
56
+
57
+ ### Data
58
+
59
+ You can then get a `brimfile.data.Data` object representing the data group in the brim file
60
+ either by getting an existing one (`brimfile.file.File.get_data`) or creating a new one (`brimfile.file.File.create_data_group`).
61
+
62
+ ```Python
63
+ # Get the first data group in the file
64
+ data = f.get_data()
65
+
66
+ # or create a new one
67
+ data = f.create_data_group(PSD, freq_GHz, (dz, dy, dx), name='my_data_group')
68
+ ```
69
+
70
+ You can get the spectrum corresponding to a pixel in the image by calling the `brimfile.data.Data.get_spectrum_in_image` method:
71
+ ```Python
72
+ PSD, frequency, PSD_units, frequency_units = data.get_spectrum_in_image((pz,py,px))
73
+ ```
74
+
75
+ ### Metadata
76
+
77
+ You can then get a `brimfile.metadata.Metadata` object by simply calling the `brimfile.data.Data.get_metadata` method on a previously retrieved `Data` object.
78
+ The returned Metadata object contains all the metadata associated with the file and the data group.
79
+ ```Python
80
+ metadata = data.get_metadata()
81
+ ```
82
+ The list of available metadata is defined [here](https://github.com/prevedel-lab/Brillouin-standard-file/blob/main/docs/brim_file_metadata.md).
83
+
84
+ New metadata can be added to the current data group (or to the whole file) by calling the `brimfile.metadata.Metadata.add` method.
85
+ ```Python
86
+ import datetime
87
+
88
+ Attr = Metadata.Item
89
+ datetime_now = datetime.now().isoformat()
90
+ temp = Attr(22.0, 'C')
91
+
92
+ metadata.add(Metadata.Type.Experiment, {'Datetime':datetime_now, 'Temperature':temp},local=True)
93
+ ```
94
+ A single metadata item can be retrieved by indexing the `Metadata` object, which takes a string in the format 'group.object', e.g. 'Experiment.Datetime'.
95
+ ```Python
96
+ datetime = metadata['Experiment.Datetime']
97
+ ```
98
+ A dictionary containing all metadata can be retrieved by calling the `brimfile.metadata.Metadata.all_to_dict` method.
99
+ ```Python
100
+ metadata.all_to_dict()
101
+ ```
102
+
103
+ ### AnalysisResults
104
+
105
+ The results of the analysis can be accessed through the `brimfile.data.Data.AnalysisResults` object, obtained by calling the `brimfile.data.Data.get_analysis_results` method on a previously retrieved `Data` object:
106
+ ``` Python
107
+ analysis_results = data.get_analysis_results()
108
+ ```
109
+ or create a new one by calling the `brimfile.data.Data.create_analysis_results_group_raw`:
110
+ ``` Python
111
+ analysis_results = data.create_analysis_results_group_raw(shift, width,
112
+ name='my_analysis_results')
113
+ ```
114
+
115
+ `AnalysisResults` also exposes a method to retrieve the images of the analysis results (`brimfile.data.Data.AnalysisResults.get_image`):
116
+
117
+ ``` Python
118
+ ar_cls = Data.AnalysisResults
119
+ img, px_size = analysis_results.get_image(ar_cls.Quantity.Shift, ar_cls.PeakType.average)
120
+ ```
121
+
122
+ ## List the contents of a brim file
123
+
124
+ The *brimfile* library provides methods to list the contents of a brim file.
125
+
126
+ To list all the data groups in a brim file, you can use the `brimfile.file.File.list_data_groups` method.
127
+
128
+ Once you have a `Data` object, you can list the analysis results in it by calling the `brimfile.data.Data.list_AnalysisResults` method.
129
+
130
+ Once you have an `AnalysisResults` object, you can determine:
131
+ - if the Stokes and/or anti-Stokes peaks are present by calling the `brimfile.data.Data.AnalysisResults.list_existing_peak_types` method;
132
+ - the available quantities (e.g. shift, linewidth, etc...) in the analysis results by calling the `brimfile.data.Data.AnalysisResults.list_existing_quantities` method.
133
+
134
+ ## Example code
135
+
136
+ Here is a simple example which creates a brim file with a data group and some metadata and then reads it back.
137
+
138
+ We first write a function to generate some dummy data:
139
+
140
+ ``` Python
141
+ import numpy as np
142
+
143
+ def generate_data():
144
+ def lorentzian(x, x0, w):
145
+ return 1/(1+((x-x0)/(w/2))**2)
146
+ Nx, Ny, Nz = (7, 5, 3) # Number of points in x,y,z
147
+ dx, dy, dz = (0.4, 0.5, 2) # Stepsizes (in um)
148
+ n_points = Nx*Ny*Nz # total number of points
149
+
150
+ width_GHz = 0.4
151
+ width_GHz_arr = np.full(n_points, width_GHz)
152
+ shift_GHz_arr = np.empty(n_points)
153
+ freq_GHz = np.linspace(6, 9, 151) # 151 frequency points
154
+ PSD = np.empty((Nz, Ny, Nx, len(freq_GHz)))
155
+ for i in range(Nz):
156
+ for j in range(Ny):
157
+ for k in range(Nx):
158
+ index = k + Nx*j + Ny*Nx*i
159
+ #let's increase the shift linearly to have a readout
160
+ shift_GHz = freq_GHz[0] + (freq_GHz[-1]-freq_GHz[0]) * index/n_points
161
+ spectrum = lorentzian(freq_GHz, shift_GHz, width_GHz)
162
+ shift_GHz_arr[index] = shift_GHz
163
+ PSD[i, j, k,:] = spectrum
164
+
165
+ return PSD, freq_GHz, (dz,dy,dx), shift_GHz_arr, width_GHz_arr
166
+ ```
167
+
168
+ Now we can use this function to create a brim file with a data group and some metadata:
169
+
170
+ ``` Python
171
+ from brimfile import File, Data, Metadata
172
+ from datetime import datetime
173
+
174
+ filename = 'path/to/your/file.brim.zip'
175
+
176
+ f = File.create(filename, store_type='auto')
177
+
178
+ PSD, freq_GHz, (dz,dy,dx), shift_GHz, width_GHz = generate_data()
179
+
180
+ d0 = f.create_data_group(PSD, freq_GHz, (dz,dy,dx), name='test1')
181
+
182
+ # Create the metadata
183
+ Attr = Metadata.Item
184
+ datetime_now = datetime.now().isoformat()
185
+ temp = Attr(22.0, 'C')
186
+ md = d0.get_metadata()
187
+
188
+ md.add(Metadata.Type.Experiment, {'Datetime':datetime_now, 'Temperature':temp})
189
+ md.add(Metadata.Type.Optics, {'Wavelength':Attr(660, 'nm')})
190
+ # Add some metadata to the local data group
191
+ temp = Attr(37.0, 'C')
192
+ md.add(Metadata.Type.Experiment, {'Temperature':temp}, local=True)
193
+
194
+ # create the analysis results
195
+ ar = d0.create_analysis_results_group_raw(({'shift':shift_GHz, 'shift_units': 'GHz',
196
+ 'width': width_GHz, 'width_units': 'Hz'},),
197
+ ({'shift':shift_GHz, 'shift_units': 'GHz',
198
+ 'width': width_GHz, 'width_units': 'Hz'},),
199
+ name = 'test1_analysis')
200
+ f.close()
201
+ ```
202
+ and we can read it back:
203
+ ``` Python
204
+ from brimfile import File, Data, Metadata
205
+
206
+ filename = 'path/to/your/file.brim.zip'
207
+
208
+ f = File(filename)
209
+
210
+ # check if the file is read only
211
+ f.is_read_only()
212
+
213
+ #list all the data groups in the file
214
+ data_groups = f.list_data_groups(retrieve_custom_name=True)
215
+
216
+ # get the first data group in the file
217
+ d = f.get_data()
218
+ # get the name of the data group
219
+ d.get_name()
220
+
221
+ # get the number of parameters which the spectra depend on
222
+ n_pars = d.get_num_parameters()
223
+
224
+ # get the metadata
225
+ md = d.get_metadata()
226
+ all_metadata = md.all_to_dict()
227
+ # the list of metadata is defined here https://github.com/prevedel-lab/Brillouin-standard-file/blob/main/docs/brim_file_metadata.md
228
+ time = md['Experiment.Datetime']
229
+ time.value
230
+ time.units
231
+ temp = md['Experiment.Temperature']
232
+ md_dict = md.to_dict(Metadata.Type.Experiment)
233
+
234
+
235
+ #get the list of analysis results in the data group
236
+ ar_list = d.list_AnalysisResults(retrieve_custom_name=True)
237
+ # get the first analysis results in the data group
238
+ ar = d.get_analysis_results()
239
+ # get the name of the analysis results
240
+ ar.get_name()
241
+ # list the existing peak types and quantities in the analysis results
242
+ pt = ar.list_existing_peak_types()
243
+ qt = ar.list_existing_quantities()
244
+ # get the image of the shift quantity for the average of the Stokes and anti-Stokes peaks
245
+ img, px_size = ar.get_image(Data.AnalysisResults.Quantity.Shift, Data.AnalysisResults.PeakType.average)
246
+ # get the units of the shift quantity
247
+ u = ar.get_units(Data.AnalysisResults.Quantity.Shift)
248
+
249
+ # get a quantity at a specific pixel (coord) in the image
250
+ coord = (1,3,4)
251
+ qt_at_px = ar.get_quantity_at_pixel(coord, Data.AnalysisResults.Quantity.Shift, Data.AnalysisResults.PeakType.average)
252
+ assert img[coord]==qt_at_px
253
+
254
+ # get the spectrum in the image at a specific pixel (coord)
255
+ PSD, frequency, PSD_units, frequency_units = d.get_spectrum_in_image(coord)
256
+
257
+ f.close()
258
+ ```
259
+
260
+ ## Export the data to a different format
261
+
262
+ ### OME-TIFF
263
+
264
+ You can export a specific quantity in the analyzed data to OME-TIFF files using the `brimfile.data.Data.AnalysisResults.save_image_to_OMETiff` method on an instance `ar` of the `AnalysisResults` class.
265
+ ``` Python
266
+ ar_cls = Data.AnalysisResults
267
+ ar.save_image_to_OMETiff(ar_cls.Quantity.Shift, ar_cls.PeakType.average, filename='path/to/your/exported_tiff' )
268
+ ```
269
+ """
270
+
271
+ __version__ = "1.0.0"
272
+
273
+ from .file import File
274
+ from .data import Data
275
+ from .metadata import Metadata
@@ -0,0 +1,28 @@
1
+ __docformat__ = "google"
2
+
3
+ reserved_attr_names = ('Units', 'Name')
4
+
5
+
6
+ class brim_obj_names:
7
+ """
8
+ This class contains the names of the objects in the brim file.
9
+ """
10
+ Brillouin_base_path = 'Brillouin_data/'
11
+
12
+ class data:
13
+ """
14
+ This class contains the names of the data groups in the brim file.
15
+ """
16
+ base_group = 'Data'
17
+ PSD = 'PSD'
18
+ frequency = 'Frequency'
19
+ parameters = 'Parameters'
20
+ analysis_results = 'Analysis'
21
+ spatial_map = 'Scanning/Spatial_map'
22
+ cartesian_visualisation = 'Scanning/Cartesian_visualisation'
23
+
24
+ class metadata:
25
+ """
26
+ This class contains the names of the metadata groups in the brim file.
27
+ """
28
+ base_group = 'Metadata'