pwem.wizards.wizard module

This module implement some base classes and utils for wizards The content of this module is not discovered at runtime by pyworkflow. Usage of this content is though importing it

class pwem.wizards.wizard.BandPassFilterDialog(parent, provider, **args)[source]

Bases: DownsampleDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

addFreqSlider(label, value, col)[source]
getFreqDecay()[source]
getHighFreq()[source]
getLowFreq()[source]
updateFilteredImage()[source]
class pwem.wizards.wizard.ColorScaleDialog(parentWindow, lowest, highest, intervals, colorPalette)[source]

Bases: Dialog

This will assist users to choose the color scale and range for local resolution viewers

Parameters
  • highest – highest resolution value for the scale

  • lowest – lowest resolution value for the scale

  • intervals – number of labels for the scale

  • colorPalette – color palette to use

body(master)[source]

Draws the main frame of the dialog

getAvailablePalettes()[source]

Returns a list of all available palettes

getColorPalette()[source]
getHighest()[source]
getIntervals()[source]
getLowest()[source]
class pwem.wizards.wizard.ColorScaleWizardBase[source]

Bases: EmWizard

Base wizard to edit color scale parameters Usage:

1.- define new class inheriting this one 2.- declare _targets = ColorScaleWizardBase.defineTargets(youviewer) in a class scope, right after class definition. 3.- call ColorScaleWizardBase.defineColorScaleParams(group) in your viewer._defineParams 4.- use attributes in your plotting method

static defineColorScaleParams(form, defaultHighest=10, defaultLowest=0, defaultIntervals=11, defaultColorMap='jet')[source]
classmethod defineTargets(*viewersClass)[source]

:return targets list per each viewer class passed

show(form)[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.CtfDialog(parent, provider, **args)[source]

Bases: DownsampleDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

downKeyPress(event)[source]
getDownsample()[source]
static getFreq(freqSlider)[source]
getHighFreq()[source]
getLowFreq()[source]
highlightInnerSlider()[source]
highlightOuterSlider()[source]
makeBigger(event)[source]
makeSmaller(event)[source]
manageMaskVals()[source]
static setFreq(freqSlider, val)[source]
showValues(var2set, labSlider)[source]

Show the values selected for the inner and outer radius. If the units are angstroms (sampling_rate = 1, it will show only one value to avoid redundancies

upKeyPress(event)[source]
updateFreqRing()[source]
updateSliderInnerRadius()[source]
updateSliderOuterRadius()[source]
class pwem.wizards.wizard.CtfDownsampleDialog(parent, provider, **args)[source]

Bases: CtfDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

getDownsample()[source]
class pwem.wizards.wizard.CtfWizard[source]

Bases: EmWizard

classmethod getView()[source]

EMPTY METHOD. Deprecated.This method should return the string value of the view in web that will respond to this wizard. This method only should be implemented in those wizards that have WEB_DJANGO environment defined.

show(form, value, label, units='px')[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.DownsampleDialog(parent, provider, **args)[source]

Bases: ImagePreviewDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

getDownsample()[source]
manageMaskVals()[source]
class pwem.wizards.wizard.DownsampleWizard[source]

Bases: EmWizard

classmethod getView()[source]

EMPTY METHOD. Deprecated.This method should return the string value of the view in web that will respond to this wizard. This method only should be implemented in those wizards that have WEB_DJANGO environment defined.

show(form, value, label, units='px')[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.EmWizard[source]

Bases: Wizard

class pwem.wizards.wizard.FilterParticlesWizard[source]

Bases: FilterWizard

class pwem.wizards.wizard.FilterVolumesWizard[source]

Bases: FilterWizard

class pwem.wizards.wizard.FilterWizard[source]

Bases: EmWizard

show(form, value, label, mode, unit='px', **args)[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.FormulaDialog(parentWindow, set, formula='')[source]

Bases: Dialog

This will assist users to create a formula based on class attibutes.

Parameters
  • set – set with the items to use in the formulae

  • formula – initial formulate to load

addAttributeToFormula(event)[source]
body(master)[source]

Draws the main frame of the dialog

evaluateFormula(name='', index='', mode='')[source]
getFormula()[source]
getItem()[source]
class pwem.wizards.wizard.GaussianFilterDialog(parent, provider, **args)[source]

Bases: BandPassFilterDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

getFreqSigma()[source]
class pwem.wizards.wizard.GaussianParticlesWizard[source]

Bases: GaussianWizard

class pwem.wizards.wizard.GaussianVolumesWizard[source]

Bases: GaussianWizard

class pwem.wizards.wizard.GaussianWizard[source]

Bases: EmWizard

show(form, value, label, units='1/px')[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.ImagePreviewDialog(parent, provider, **args)[source]

Bases: PreviewDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

class pwem.wizards.wizard.MaskPreviewDialog(parent, provider, **args)[source]

Bases: ImagePreviewDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

addRadiusBox(parent)[source]
static getRadius(radiusSlider)[source]
getRadiusAngstroms(radiusSlider)[source]
makeBigger(event)[source]
makeSmaller(event)[source]
manageMaskVals()[source]
static setRadius(radiusSlider, val)[source]
showValues(var2set, radiusSlider)[source]

Show the values selected for the inner and outer radius. If the units are angstroms (sampling_rate = 1, it will show only one value to avoid redundancies

updateSliderRadius()[source]
class pwem.wizards.wizard.MaskRadiiPreviewDialog(parent, provider, **args)[source]

Bases: MaskPreviewDialog

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

downKeyPress(event)[source]
highlightInnerSlider()[source]
highlightOuterSlider()[source]
makeBigger(event)[source]
makeSmaller(event)[source]
manageMaskVals()[source]
upKeyPress(event)[source]
updateSliderInnerRadius()[source]
updateSliderOuterRadius()[source]
class pwem.wizards.wizard.MaskRadiiWizard[source]

Bases: EmWizard

classmethod getView()[source]

EMPTY METHOD. Deprecated.This method should return the string value of the view in web that will respond to this wizard. This method only should be implemented in those wizards that have WEB_DJANGO environment defined.

show(form, value, label, units='px')[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.MaskRadiusWizard[source]

Bases: EmWizard

setVar(form, label, value)[source]
show(form, value, label, units='px')[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.PDBVolumeWizard[source]

Bases: EmWizard

show(form)[source]

EMPTY METHOD. Needs to be implemented in your class. This will be called to show the wizard.

Parameters
  • form – the protocol form, given access to to all parameters. Some times the same wizard will modify several elements in the form.

  • params – a list of params to modify. Sometimes the wizard can be generic and can be used for different parameters in the same form.

class pwem.wizards.wizard.ParticleMaskRadiusWizard[source]

Bases: MaskRadiusWizard

class pwem.wizards.wizard.ParticlesMaskRadiiWizard[source]

Bases: MaskRadiiWizard

class pwem.wizards.wizard.PreviewDialog(parent, provider, **args)[source]

Bases: Dialog

This will be the base class for several wizards. The layout of this wizard will be: 1. Left panel(Items) that contains a list of items to preview 2. Right-top panel (Preview) where some preview of the items will be displayed 3. Right-bottom panel (Controls) where some controls can change the preview

Params:

parent: parent windows of the dialog. provider: the TreeProvider to populate items tree.

body(bodyFrame)[source]

create dialog body. return widget that should have initial focus. This method should be overridden, and is called by the __init__ method.

class pwem.wizards.wizard.VariableWizard[source]

Bases: Wizard

Wizard base class object where input and output paramNames can be modified and added, so one wizard can be used in several protocols with parameters of different names

addTarget(protocol, targets, inputs, outputs)[source]

Add a target to a wizard and the input and output parameters are stored in a dictionary with (protocol, targetParamName) as key. Targets must be added one by one.

filterPresentInputs(inputParams, protocol)[source]

Filter the inputs to allow flexibility: 1) InputParams can be lists: the first not None parameter of the list will be chosen. 2) InputParams can be dict: key -> EnumParam (or IntParam) which functions as index

value -> list containing paramNames. The hey index element will be chosen

getInputOutput(form)[source]

Retrieving input and output paramNames corresponding to the protocol and target of the wizard clicked

class pwem.wizards.wizard.VolumeMaskRadiiWizard[source]

Bases: MaskRadiiWizard

class pwem.wizards.wizard.VolumeMaskRadiusWizard[source]

Bases: MaskRadiusWizard

pwem.wizards.wizard.insertText(target, textToInsert, position)[source]

Inserts a text into another at a position

Parameters
  • target – text to do the insertion on

  • textToInsert – text to be inserted

  • position – position where to insert the new text