Discussion:
cmf file format in ArgyllCMS
Richard Hughes
2014-01-07 14:32:50 UTC
Permalink
Hi all,

In http://www.argyllcms.com/doc/ArgyllDoc.html there is mention of a
CMF file format, but no examples in the tarball or documentation on
the website. Looking at the code, it appears to have the same format
as the spectral power examples (.sp files) but without a index or type
that can be used to store different sets for XYZ.

I'm wondering how to store a CMF in a portable way, as write_nxspect()
seems to write a 1D array without any sample ID. I had hoped to store
the CMF with the X, Y and Z data as 3 "sets" of data in the CGATS
file. At the moment I'm using .csv files. Advice welcome.

Thanks,

Richard
Graeme Gill
2014-01-09 00:50:07 UTC
Permalink
Post by Richard Hughes
In http://www.argyllcms.com/doc/ArgyllDoc.html there is mention of a
CMF file format, but no examples in the tarball or documentation on
the website. Looking at the code, it appears to have the same format
as the spectral power examples (.sp files) but without a index or type
that can be used to store different sets for XYZ.
Hello Richard,
it's something I've used in some private code, and I added support
for it in specplot. I haven't added an index field at this stage, although
I might do at some latter point in time. It's implicitly X, Y & Z.

In the furture I could use it to allow a CMF to be specified on the
command line using a file, rather than being restricted to built in
observers (I started work on a project that might make use of this).
Post by Richard Hughes
I'm wondering how to store a CMF in a portable way, as write_nxspect()
seems to write a 1D array without any sample ID. I had hoped to store
the CMF with the X, Y and Z data as 3 "sets" of data in the CGATS
file. At the moment I'm using .csv files. Advice welcome.
Perhaps you could explain what you are looking for ?
write_nxspect() will save an array of 3 xspect's forming a CMF,
and read_nxspect() will recover them.

Graeme.
Richard Hughes
2014-01-09 08:19:19 UTC
Permalink
Post by Graeme Gill
Hello Richard,
it's something I've used in some private code, and I added support
for it in specplot. I haven't added an index field at this stage, although
I might do at some latter point in time. It's implicitly X, Y & Z.
So it's fair to say that CMFs always have 3 sets of unindexed data,
implicitly XYZ, and that spectral plots can contain 1..n sets of data
that can optionally be indexed. If that's true I'll do the same in
colord then users can re-use the specplot command as a visual check.
Post by Graeme Gill
Perhaps you could explain what you are looking for ?
I'm really just playing and learning at this point, CCTs, CRIs etc.
I'm adding some helper functions into libcolord that allow me to load
and save spectra to a file, and I figured it was better to use
something existing rather than re-invent the wheel.

On that note, what does SPECTRAL_NORM mean? I expected it to mean that
all the data vales were normallized to that value, but example.sp
seems to have data values larger than the SPECTRAL_NORM value.

Thanks,

Richard.
Graeme Gill
2014-01-09 11:10:52 UTC
Permalink
Post by Richard Hughes
On that note, what does SPECTRAL_NORM mean? I expected it to mean that
all the data vales were normallized to that value, but example.sp
seems to have data values larger than the SPECTRAL_NORM value.
It's a bit vague. The intention is to disambiguate 0..1 and 0..100% ranges for
reflectance and transmittance. For emission, setting it to 1.0 is safest.

Graeme.
Richard Hughes
2014-01-09 13:31:32 UTC
Permalink
Post by Graeme Gill
It's a bit vague. The intention is to disambiguate 0..1 and 0..100% ranges for
reflectance and transmittance. For emission, setting it to 1.0 is safest.
I've come across another couple of oddities when using specplot -- it
doesn't seem to read my generated SPECT or CMF files at all. I'm using
lcms2 to write the cgats files, and I can't work out why they wouldn't
be compatible with argyllcms. I get:

specplot: Error - Unable to read custom spectrum, CMF or CCSS
'data/cmf/CIE1964-10deg-XYZ.cmf'

...and no other more helpful error. I'd very much appreciate if you
can give any pointers.

I've attached two sample files that specplot fails to read. Thanks again.

Richard.
Florian Höch
2014-01-09 20:09:34 UTC
Permalink
Post by Richard Hughes
I've come across another couple of oddities when using specplot -- it
doesn't seem to read my generated SPECT or CMF files at all. I'm using
lcms2 to write the cgats files, and I can't work out why they wouldn't
specplot: Error - Unable to read custom spectrum, CMF or CCSS
'data/cmf/CIE1964-10deg-XYZ.cmf'
It seems to choke on values between BEGIN_DATA..END_DATA that use
integer instead of float formatting. After adding a few .0's to the
integers, the files plot :)

Florian
Richard Hughes
2014-01-09 20:33:20 UTC
Permalink
Post by Florian Höch
It seems to choke on values between BEGIN_DATA..END_DATA that use
integer instead of float formatting. After adding a few .0's to the
integers, the files plot :)
Bingo! I'll change the float formatter in the lcms2 code I'm using. Thanks.

Richard
Graeme Gill
2014-01-09 23:08:15 UTC
Permalink
Post by Florian Höch
It seems to choke on values between BEGIN_DATA..END_DATA that use
integer instead of float formatting. After adding a few .0's to the
integers, the files plot :)
Yep, cgatslib has to guess what type non-standard fields are, and will
get it wrong if they look like integers. I guess the proper fix for
this would be to add a function to cgatslib to allow the client application
to promote fields to a known type.

Graeme Gill.

Loading...