![]() ``calibName = tCurrent(0)`` fetches the first calibration (alphabetically) for this monitor ``calibName = tCurrent(-1)`` fetches the last **alphabetical** calibration for this monitor (this is default). In Monitor Center you can 'copy.' a calibration and give it a new name to keep a second version. You can name calibrations what you want but PsychoPy will give them names of date/time by default. Note that a single file can hold multiple calibrations each stored under a different key (the date it was taken) The argument is either a string (naming the calib) or an integer **eg**: ``tCurrent('mainCalib')`` fetches the calibration named mainCalib. def setCurrent ( self, calibration =- 1 ): """Sets the current calibration for this monitor. setNotes ( notes ) if useBits != None : self. setDistance ( distance ) if gamma : self. " "Creating a temporary one." ) # override current monitor settings with the vals given if width : self. warning ( "Monitor specification not found. info ( 'Loaded monitor calibration from %s ' % self. setCurrent ( - 1 ) # will fetch previous vals if monitor exists if self. These can be saved to the monitor file using :func:`~` or not (in which case the changes will be lost) """ def _init_ ( self, name, width = None, distance = None, gamma = None, notes = None, useBits = None, verbose = True, currentCalib = None, autoLog = True ): """ """ # make sure that all necessary settings have some value super ( Monitor, self ). **eg**: ``myMon = Monitor('sony500', distance=114)`` Fetches the info on the sony500 and overrides its usual distance to be 114cm for this experiment. Use with caution since the dictionary may not contain all the necessary fields that a monitor object expects to find. **arguments**: - ``width, distance, gamma`` are details about the calibration - ``notes`` is a text field to store any useful info - ``useBits`` True, False, None - ``verbose`` True, False, None - ``currentCalib`` is a dictionary object containing various fields for a calibration. Many settings from the stored monitor can easily be overridden either by adding them as arguments during the initial call. This will be loaded automatically from disk if the monitor name is already defined (see methods). class Monitor : """Creates a monitor object for storing calibration details. makedirs ( monitorFolder ) except OSError as err : if err. ![]() ![]() if isinstance ( monitorFolder, bytes ): monitorFolder = monitorFolder. Right now, errors will still occur if `monitorFolder` is # combined with `str`-type objects that contain non-ASCII characters. However, this is not a proper # fix, since *everything* should be decoded to Unicode, and not just this # specific pathname. environ, '.psychop圓', 'monitors' ) # HACK for Python2.7! On system where `monitorFolder` contains special characters, # for example because the Windows profile name does, `monitorFolder` must be # decoded to Unicode to prevent errors later on. renames ( oldMonitorFolder, monitorFolder ) else : monitorFolder = join ( os. environ, 'psychop圓', 'monitors' ) if os. expanduser ( '~' ), '.psychop圓', 'monitors' ) monitorFolder = join ( os. platform = 'win32' : # we used this for a while (until 0.95.4) but not the proper place for # windows app data oldMonitorFolder = join ( os. calibData import wavelength_5nm, juddVosXYZ1976_5nm, cones_SmithPokorny from psychopy import _version_, logging, hardware try : import serial haveSerial = True except ( ModuleNotFoundError, ImportError ): haveSerial = False import errno import os import time import glob import sys from copy import deepcopy, copy import numpy as np from scipy import interpolate import json_tricks # allows json to dump/load np.arrays and dates DEBUG = False # set and create (if necess) the data folder # this will be the # Linux/Mac: ~/.psychopy2/monitors # win32: /Application Data/PsychoPy/monitors join = os. # Distributed under the terms of the GNU General Public License (GPL). #!/usr/bin/env python # -*- coding: utf-8 -*- """Tools to help with calibrations """ # Part of the PsychoPy library # Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd.
0 Comments
Leave a Reply. |