def __init__(self, gray_level=0.66, c=0.12, sscale=2.6, unit='rad', depthBits=8, subject=None): """ Color Picker for generating sml and RGB values with hue angles on an iso-luminance plane, and vice versa. Advanced features: - switch color depths; - adjust the iso-luminance plane for single subjects; - generate display-realizable hue lists - display a color circle :param gray_level: default is 0.66 :param c: contrast (i.e. chromaticity since we use iso-luminance); no larger than 0.155; default is 0.12 :param sscale: just for better viewing, usually no need to change; default is 2.6 :param unit: hue angle unit: radian[default] or degree :param depthBits: color depth: 8[default] or 10 :param subject: perform subjective adjustment if not None. Subject isolum files will be searched and used. """ self.gray_level = gray_level # this is determined from the calibration file (rgb2lms) self.c = c self.sscale = sscale # self.unit = unit self.depthBits = depthBits # 8 or 10-bit self.subject = subject """load calibration file and make transformations""" self.calib = rgb2sml_plus.calibration(rgb2sml_plus.openfile( )) # Load the parameters of the calibration file self.transf = rgb2sml_plus.transformation( self.calib.A0(), self.calib.AMatrix(), self.calib.Gamma(), self.depthBits ) # Creates an object transf that has as methods all the needed transformations self.Csml = self.transf.center() self.Crgb = self.transf.sml2rgb(self.Csml) if self.depthBits == 8: self.colorSpace = "rgb255" elif self.depthBits == 10: self.colorSpace = "rgb" else: raise ValueError
user = dlg.data[0] id = time.strftime("%Y%m%dT%H%M", time.localtime()) # add the current date os.makedirs(path + user) # create a new folder named by user name in current path return user, id user, id = userinfo(path='isolum/') path = 'isolum/' + user """load calibration file and make transformations""" info = rgb2sml_plus.openfile().splitlines() calibinfo = info[0:2] + info[7:17] calib = rgb2sml_plus.calibration( rgb2sml_plus.openfile()) # Load the parameters of the calibration file transf = rgb2sml_plus.transformation( calib.A0(), calib.AMatrix(), calib.Gamma() ) # Creates an object transf that has as methods all the needed transformations gray_level = 0.66 # this is determined from the calibration file (rgb2lms) # get the gray color in the center of the color space ColorPicker = colorpalette_plus.ColorPicker(unit='rad') Csml = ColorPicker.Csml Crgb = ColorPicker.Crgb win = visual.Window(unit='pix', size=[1200, 1200], allowGUI=True,