gcc warning: braces around scalar initializer

You should remove the braces: { and } around single values. struct TECH lut_model_1[2] = {{296.001465, 74.216972, 2.025908, 1.516384, 1, {0.001746, 0.000256, 0.006216, 0.005249, -0.001668, -0.001377, 0.009865, 0.010454, -0.000288, -0.005853, 0.010584, 0.015440, 0.000465, -0.000602, 0.004330, 0.005700, 0.017120, 0.233015, 0.034154, 0.244022, 0.007644, 0.385683, 0.042960, 0.406633, -0.007811, 0.346931, 0.040123, 0.387361, 0.007030, 0.225309, 0.017897, 0.241024, 0.003700, 0.103601, 0.060748, … Read more

Is there a convenient way to apply a lookup table to a large array in numpy?

You can just use image to index into lut if lut is 1D. Here’s a starter on indexing in NumPy: http://www.scipy.org/Tentative_NumPy_Tutorial#head-864862d3f2bb4c32f04260fac61eb4ef34788c4c In [54]: lut = np.arange(10) * 10 In [55]: img = np.random.randint(0,9,size=(3,3)) In [56]: lut Out[56]: array([ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90]) In [57]: img Out[57]: array([[2, 2, 4], … Read more