image data seems to work in general with python3 ...

... after fix for colormaps
imageDataDeformed is based on the core module, i.e. it has not been used
for years. Either update soon or remove
This commit is contained in:
Martin Diehl 2020-03-17 11:53:59 +01:00
parent 49caa77bbd
commit 25b3fa4427
4 changed files with 10 additions and 18 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python3
import os import os
import sys import sys
@ -102,6 +102,7 @@ parser.set_defaults(label = None,
) )
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None]
if options.pixelsize > 1: (options.pixelsizex,options.pixelsizey) = [options.pixelsize]*2 if options.pixelsize > 1: (options.pixelsizex,options.pixelsizey) = [options.pixelsize]*2
@ -112,9 +113,6 @@ if options.invert: theMap = theMap.invert()
theColors = np.uint8(np.array(theMap.export(format = 'list',steps = 256))*255) theColors = np.uint8(np.array(theMap.export(format = 'list',steps = 256))*255)
# --- loop over input files ------------------------------------------------------------------------- # --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
try: try:
table = damask.ASCIItable(name = name, labeled = options.label is not None, readonly = True) table = damask.ASCIItable(name = name, labeled = options.label is not None, readonly = True)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python3
import os import os
import sys import sys
@ -95,6 +95,7 @@ parser.set_defaults(label = None,
) )
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None]
options.size = np.array(options.size) options.size = np.array(options.size)
options.dimension = np.array(options.dimension) options.dimension = np.array(options.dimension)
@ -109,16 +110,12 @@ if options.invert: theMap = theMap.invert()
theColors = np.uint8(np.array(theMap.export(format='list',steps=256))*255) theColors = np.uint8(np.array(theMap.export(format='list',steps=256))*255)
# --- loop over input files ------------------------------------------------------------------------- # --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
try: try:
table = damask.ASCIItable(name = name, readonly = True, table = damask.ASCIItable(name = name, labeled = options.label is not None, readonly = True)
labeled = options.label is not None)
except IOError: except IOError:
continue continue
table.report_name(scriptName,name) damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------ # ------------------------------------------ read header ------------------------------------------

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python3
import os import os
import sys import sys
@ -72,18 +72,15 @@ parser.set_defaults(label = None,
) )
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None]
if options.dimension == []: parser.error('dimension of data array missing') if options.dimension == []: parser.error('dimension of data array missing')
if options.pixelsize > 1: (options.pixelsizex,options.pixelsizey) = [options.pixelsize]*2 if options.pixelsize > 1: (options.pixelsizex,options.pixelsizey) = [options.pixelsize]*2
# --- loop over input files ------------------------------------------------------------------------- # --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
try: try:
table = damask.ASCIItable(name = name, readonly = True, table = damask.ASCIItable(name = name, labeled = options.label is not None, readonly = True)
labeled = options.label is not None)
except IOError: except IOError:
continue continue
damask.util.report(scriptName,name) damask.util.report(scriptName,name)

View File

@ -218,7 +218,7 @@ class Color:
if (self.color[i] > 0.04045): RGB_lin[i] = ((self.color[i]+0.0555)/1.0555)**2.4 if (self.color[i] > 0.04045): RGB_lin[i] = ((self.color[i]+0.0555)/1.0555)**2.4
else: RGB_lin[i] = self.color[i] /12.92 else: RGB_lin[i] = self.color[i] /12.92
XYZ = np.dot(convert,RGB_lin) XYZ = np.dot(convert,RGB_lin)
XYZ = np.clip(XYZ,0.0) XYZ = np.clip(XYZ,0.0,None)
converted = Color('XYZ', XYZ) converted = Color('XYZ', XYZ)
self.model = converted.model self.model = converted.model