shesha.supervisor

class shesha.supervisor.compassSupervisor.CompassSupervisor(configFile: str = None, BRAHMA: bool = False, use_DB: bool = False)
clearInitSim() → None

Clear the initialization of the simulation

closeLoop() → None

DM receives controller output + pertuVoltage

computeIMatModal(M2V: numpy.ndarray, pushVector: numpy.ndarray, refOffset: numpy.ndarray, noise: bool, useAtmos: bool) → numpy.ndarray

TODO Computes a modal interaction matrix for the given modal matrix with given push values (length = nModes) around an (optional) offset value optionally with noise with/without atmos shown to WFS

enableAtmos(enable) → None

TODO Set or unset whether atmos is enabled when running loop (see singleNext)

forceContext() → None

Clear the initialization of the simulation

getAllDataLoop(nIter: int, slope: bool, command: bool, target: bool, intensity: bool, targetPhase: bool) → numpy.ndarray

Returns a sequence of data at continuous loop steps. Requires loop to be asynchronously running

getAtmScreen(indx: int) → numpy.ndarray

return the selected atmos screen

getCentroids(nControl: int)

Return the centroids of the nControl controller

getCmat(nControl: int)

Return the command matrix of the controller

nControl: (int): controller index

getCom(nControl: int)

Get command from nControl controller

getConfig()

Returns the configuration in use, in a supervisor specific format ?

getDmShape(indx: int) → numpy.ndarray

return the selected DM screen

getErr(nControl: int)

Get command increment from nControl controller

getFrameCounter() → int

return the current frame counter of the loop

getIFsparse(nControl: int)

Return the IF of DM as a sparse matrix

getIFtt(nControl: int)

Return the IF of a TT DM as a sparse matrix

getImat(nControl: int)

Return the interaction matrix of the controller

nControl: (int): controller index

getIntensities() → numpy.ndarray

Return sum of intensities in subaps. Size nSubaps, same order as slopes

getPyrHRImage(numWFS: int = 0) → numpy.ndarray

Get an HR image from the WFS

getRefSlopes() → numpy.ndarray

Get the currently used reference slopes

getSlope() → numpy.ndarray

Immediately gets one slope vector for all WFS at the current state of the system

getSlopeGeom(numWFS: int) → numpy.ndarray

return the slopes geom of WFS number numWFS

getStrehl(numTar: int) → numpy.ndarray

return the Strehl Ratio of target number numTar

getTarImage(tarID, expoType: str = 'se') → numpy.ndarray

Get an image from a target

getTarPhase(numTar: int) → numpy.ndarray

return the target screen of target number numTar

getVoltage(nControl: int)

Get voltages from nControl controller

getWfsImage(numWFS: int = 0) → numpy.ndarray

Get an image from the WFS

getWfsPhase(numWFS: int) → numpy.ndarray

return the WFS screen of WFS number numWFS

initConfig() → None

Initialize the simulation

isInit() → bool

return the status on COMPASS init

loadConfig(configFile: str = None, sim=None) → None

Init the COMPASS simulator wih the configFile

loop(n: int = 1, monitoring_freq: int = 100, **kwargs)

Perform the AO loop for n iterations

Parameters:n: (int): (optional) Number of iteration that will be done monitoring_freq: (int): (optional) Monitoring frequency [frames]
openLoop(rst=True) → None

Integrator computation goes to /dev/null but pertuVoltage still applied

removePerturbationVoltage(nControl: int, name: str) → None

Remove the perturbation voltage called <name>, from the controller number <nControl>. If you want to remove all of them, see function resetPerturbationVoltage().

resetCommand(nctrl: int = -1) → None

Reset the nctrl Controller command buffer, reset all controllers if nctrl == -1

resetDM(numdm: int = -1) → None

Reset the DM number nDM or all DMs if == -1

resetPerturbationVoltage(nControl: int) → None

Reset the perturbation voltage of the nControl controller (i.e. will remove ALL perturbation voltages.) If you want to reset just one, see the function removePerturbationVoltage().

resetStrehl(nTar: int) → None

Reset the Strehl Ratio of the target nTar

resetTarPhase(nTar: int) → None

Reset the phase screen of the target nTar

setCentroThresh(nCentro: int, thresh: float)

Set the threshold value of a thresholded COG

nCentro: (int): centroider index thresh: (float): new threshold value

setCommand(nctrl: int, command: numpy.ndarray) → None

Set the RTC command vector

setCommandMatrix(cMat: numpy.ndarray) → None

Set the cmat for the controller to use

setDmShapeFrom(command: numpy.ndarray) → None

Immediately sets provided command to DMs - does not affect integrator

setGain(gainMat) → None

Set the scalar gain of feedback controller loop

setNoise(noise, numwfs=0, seed=1234)

Set noise value of WFS numwfs

setOneActu(ndm: int, nactu: int, ampli: float = 1) → None

Push the selected actuator

setPerturbationVoltage(nControl: int, name: str, command: numpy.ndarray) → None

Add this offset value to integrator (will be applied at the end of next iteration)

setPyrMethod(pyrMethod)

Set pyramid compute method

setPyrModulation(pyrMod: float) → None

Set pyramid modulation value - in l/D units

setRefSlopes(refSlopes: numpy.ndarray) → None

Set given ref slopes in controller

singleNext(moveAtmos: bool = True, showAtmos: bool = True, getPSF: bool = False, getResidual: bool = False) → None

Move atmos -> getSlope -> applyControl ; One integrator step

class shesha.supervisor.benchSupervisor.BenchSupervisor(configFile: str = None, BRAHMA: bool = False, CACAO: bool = False)
closeLoop() → None

DM receives controller output + pertuVoltage

computeIMatModal(M2V: numpy.ndarray, pushVector: numpy.ndarray, refOffset: numpy.ndarray, noise: bool, useAtmos: bool) → numpy.ndarray

TODO Computes a modal interaction matrix for the given modal matrix with given push values (length = nModes) around an (optional) offset value optionally with noise with/without atmos shown to WFS

forceContext() → None

Active all the GPU devices specified in the parameters file Required for using with widgets, due to multithreaded init and in case GPU 0 is not used by the simu

getCentroids(nControl: int = 0)

Return the centroids of the nControl controller

getCmat(nControl: int = 0)

Return the command matrix of the controller

nControl: (int): controller index

getCom(nControl: int = 0) → numpy.ndarray

Get command from DM, and set it back to nCtrl controller. These should be equivalent, unless an external source controls the DM as well

getConfig()

Returns the configuration in use, in a supervisor specific format ?

getErr(nControl: int = 0) → numpy.ndarray

Get command increment from nControl controller

getFrameCounter() → int

return the current frame counter of the loop

getImat(nControl: int = 0)

Return the interaction matrix of the controller

nControl: (int): controller index

getIntensities() → numpy.ndarray

Return sum of intensities in subaps. Size nSubaps, same order as slopes

getPyrMethod(nCentro)

Get pyramid compute method

getRefSlopes() → numpy.ndarray

Get the currently used reference slopes

getSlope() → numpy.ndarray

Immediately gets one slope vector for all WFS at the current state of the system

getTarImage(tarID, expoType: str = 'se') → numpy.ndarray

Get an image from a target

getVoltage(nControl: int = 0) → numpy.ndarray

Get voltages from nControl controller

getWfsImage(numWFS: int = 0, calPix=False) → numpy.ndarray

Get an image from the WFS

initConfig() → None

Initialize the bench

isInit() → bool

return the status on COMPASS init

loadBackground(background: numpy.ndarray, nctrl: int = 0)

Load background for the given controller

loadConfig(configFile: str = None, sim=None) → None

Init the COMPASS wih the configFile

loadFlat(flat: numpy.ndarray, nctrl: int = 0)

Load flat field for the given controller

loadNewWfsFrame(numWFS: int = 0) → None

Acquire a new WFS frame, load, calibrate, centroid.

openLoop(rst=True) → None

Integrator computation goes to /dev/null but pertuVoltage still applied

resetCommand(nctrl: int = -1) → None

Reset the nctrl Controller command buffer, reset all controllers if nctrl == -1

resetDM(nDM: int) → None

Reset the DM number nDM

resetPerturbationVoltage(nControl: int = 0) → None

Reset the perturbation voltage of the nControl controller Removes all the perturbation voltage buffers currently existing in this controller

setCamCallback(camCallback: Callable)

Set the externally defined function that allows to grab frames

setCentroThresh(nCentro: int = 0, thresh: float = 0.0)

Set the threshold value of a thresholded COG

nCentro: (int): centroider index thresh: (float): new threshold value

setCommand(nctrl: int, command: numpy.ndarray) → None

TODO Immediately sets provided command to DMs - does not affect integrator

setCommandMatrix(cMat: numpy.ndarray) → None

Set the cmat for the controller to use

setDmCallback(dmGetCallback: Callable, dmSetCallback: Callable)

Set the externally defined function that allows to grab frames

setGain(gain) → None

Set the scalar gain or mgain of feedback controller loop

setOneActu(nctrl: int, ndm: int, nactu: int, ampli: float = 1, reset: bool = True) → None

Push the selected actuator

setPerturbationVoltage(nControl: int, name: str, command: numpy.ndarray) → None

Add this offset value to integrator (will be applied at the end of next iteration)

setPyrMethod(pyrMethod, nCentro: int = 0)

Set pyramid compute method

setPyrModulation(pyrMod: float) → None

Set pyramid modulation value - in l/D units

setRefSlopes(refSlopes: numpy.ndarray) → None

Set given ref slopes in controller

singleNext() → None

Move atmos -> getSlope -> applyControl ; One integrator step