Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:如何自动填充colormath光谱颜色类?_Python_List_Colormath - Fatal编程技术网

Python:如何自动填充colormath光谱颜色类?

Python:如何自动填充colormath光谱颜色类?,python,list,colormath,Python,List,Colormath,有一个问题 我不想手动提供光谱数据,而是想用列表中的数据自动填充类,但我真的不知道这是如何工作的 例如 from colormath.color_objects import LabColor, XYZColor, SpectralColor, AdobeRGBColor from colormath.color_conversions import convert_color test=[0.0864521948302278, 0.060647147441089, 0.07267471889

有一个问题

我不想手动提供光谱数据,而是想用列表中的数据自动填充类,但我真的不知道这是如何工作的

例如

from colormath.color_objects import LabColor, XYZColor, SpectralColor, AdobeRGBColor
from colormath.color_conversions import convert_color

test=[0.0864521948302278, 0.060647147441089, 0.0726747188946782, 0.0939848211034762, 0.117476972460373, 0.120470421815122, 0.135515000803907, 0.147192947184837, 0.158235428114852, 0.167354983153096, 0.176595115477727, 0.184356798767392, 0.191455139493337, 0.202102699343208, 0.214077113676754, 0.225593591186178, 0.239495675347855, 0.252998713390957, 0.268988453847135, 0.286663797550772, 0.304930930121131, 0.324055045587196, 0.340413611744997, 0.35813823359423, 0.372255852167114, 0.38710860985204, 0.400396731744843, 0.411356232148721, 0.422039413253371, 0.433510097645216, 0.445295564481938, 0.455445976037395, 0.465897317024798, 0.47640303941666, 0.485959434493102, 0.49540575001133, 0.504048573672828, 0.511424852548411, 0.518111900409216]
print (test)
test2=', '.join(str(x) for x in test)
spc2=SpectralColor(test2)
xyz = convert_color(spc2, XYZColor)
print ('xyz:', xyz)

谢谢

。。。如果有人遇到相同或类似的问题。您以不同的方式调用函数:

spc2=SpectralColor(*test)

中找到您是否知道它希望光谱数据使用的单位?它是W/m^2/nm吗?我在猜,但还没有确认。