colour.read_spectral_data_from_csv_file#
- colour.read_spectral_data_from_csv_file(path: str | PathLike, **kwargs: Any) Dict[str, NDArrayFloat][source]#
Read spectral data from the specified CSV file in the following form:
390, 4.15003e-04, 3.68349e-04, 9.54729e-03 395, 1.05192e-03, 9.58658e-04, 2.38250e-02 400, 2.40836e-03, 2.26991e-03, 5.66498e-02 ... 830, 9.74306e-07, 9.53411e-08, 0.00000
and convert it to a dict as follows:
{ 'wavelength': ndarray, 'field 1': ndarray, 'field 2': ndarray, ..., 'field n': ndarray }
- Parameters:
- Returns:
CSV file content.
- Return type:
- Raises:
IOError – If the file cannot be read.
Notes
A CSV spectral data file should at least define two fields: one for the wavelengths and one for the associated values of one spectral distribution.
Examples
>>> import os >>> from pprint import pprint >>> csv_file = os.path.join( ... os.path.dirname(__file__), ... "tests", ... "resources", ... "colorchecker_n_ohta.csv", ... ) >>> sds_data = read_spectral_data_from_csv_file(csv_file) >>> pprint(list(sds_data.keys())) ['wavelength', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']