-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
# beamtools | ||
# beamtools | ||
The *beamtools* package is a collection of methods to assist with several aspects of optical system design and analysis. | ||
## Data Objects | ||
All raw data in the package is handle via a DataObject where the data is stored as object attributes. Data objects are created from dictionaries (set of key/value pairs) and the Data Object attributes are defined by the dictionary keys. The class definition can be found in `.import_data_file.py`. | ||
All `DataObject` instances posses the class method `fields()`. Calling `DataObject.fields()` returns a list of the onjects attributes. This can be used to view the names available data arrays. | ||
## File formats | ||
A list of file formats can be found in `file_formats.py`. I have already included many common file types. More can be added to the package in the future by creating additional dictionary entries following the format and keywords given. Each file format includes a key named `alias`. These values comprise a set of alternate names which can be used anywhere in the package when specifying a file type. | ||
## Importing data | ||
Once of the most useful methods in the package is `import_data_file` which can be used to seamlessly import a variety of data types. | ||
``` | ||
import beamtools as bt | ||
#data from an ocean optics spectrometer | ||
file = 'testdata.csv' | ||
type = 'oo_spec' | ||
data = bt.import_data_file(file,type) | ||
``` | ||
Data imported by `import_data_file` is returned as a DataObject. In this example, `data.wavelength` and `data.intensity` returns numpy arrays of the wavelength and intensity data imported from the file. | ||
Any header information is stored in `data.header`. The header syntax for each file is defined in `file_formats.py`. |