def build_method_step_table_editor(known_solution_names=None):
    """ Build a custom table editor to control a list of MethodSteps
    """
    if known_solution_names is None:
        known_solution_names = []

    editor = TableEditor(
        columns=[
            ObjectColumn(name='name', label="Step Name"),
            ObjectColumn(name='step_type', label='Step Type'),
            ObjectColumn(name='_solutions0_name', label='Solution A',
                         editor=EnumEditor(values=known_solution_names)),
            ObjectColumn(name='_solutions1_name', label='Solution B',
                         editor=EnumEditor(values=known_solution_names)),
            UnitScalarColumn(name='flow_rate', label='Flow Rate',
                             editor=UnitScalarEditor()),
            UnitScalarColumn(name='volume', label='Volume',
                             editor=UnitScalarEditor()),
        ],
        deletable=True,
        auto_size=True,
        row_factory=MethodStep,
        row_factory_kw={"name": "New Step"},
        show_toolbar=True,
        sortable=False,
    )
    return editor
 def default_traits_view(self):
     view = View(
         VGroup(
             HGroup(
                 Item('model.name', width=300),
                 Spring(),
                 Item('model.product_type', style="readonly", label="Type"),
             ),
             Item("model.description", style="custom"),
             Item('model.pI', editor=UnitScalarEditor(), label="pI"),
             VGroup(Item('model.product_components',
                         show_label=False,
                         editor=COMPONENT_TABLE_EDITOR),
                    show_border=True,
                    label="Product components"),
             VGroup(Item('model.product_component_concentration_exps',
                         editor=COMPONENT_CONC_EXPRESSION_EDITOR,
                         show_label=False),
                    show_border=True,
                    label="Product component concentration expressions"),
             VGroup(Item('product_component_assays',
                         editor=ASSAY_TABLE_EDITOR,
                         show_label=False),
                    show_border=True,
                    label="Assays"),
         ),
         resizable=True,
     )
     return view
    def default_traits_view(self):
        pka_tooltip = ("Negative logarithm of the acidity constant of the "
                       "component")
        view = View(
            Item("model.name"),
            Item("model.charge", label="Charge",
                 editor=UnitScalarEditor()),
            Item("model.pKa", label="pKa", tooltip=pka_tooltip,
                 editor=UnitScalarEditor()),

            # Relevant when used as standalone view:
            resizable=True, buttons=OKCancelButtons,
            title="Configure component"
        )

        return view
Exemple #4
0
def build_assay_list_editor(known_assays_names):
    """ Build a table editor to display a list of product assays.

    Parameters
    ----------
    known_assays_names : list(str)
        List of assay names available, if wanting to allow users to add assays.
    """
    if known_assays_names:
        row_factory = ProductAssay
        default_name = known_assays_names[0]
    else:
        row_factory = False
        default_name = ""

    editor = TableEditor(
        columns=[
            ObjectColumn(name='name',
                         editor=EnumEditor(values=known_assays_names)),
            UnitScalarColumn(name='proportion', editor=UnitScalarEditor())
        ],
        editable=True,
        sortable=False,
        deletable=True,
        row_factory=row_factory,
        row_factory_kw={"name": default_name},
    )
    return editor
Exemple #5
0
    def default_traits_view(self):
        prod = self.model.product
        all_assays = prod.product_component_assays
        assay_names = [assay for assay in all_assays
                       if assay != STRIP_COMP_NAME]
        if self.datasource:
            component_names = self.datasource.get_object_names_by_type(
                "components"
            )
        else:
            component_names = []

        view = View(
            Item('model.name', label='Name'),
            Item('model.product_concentration', label='Product Concentration',
                 editor=UnitScalarEditor()),
            Item('model.conductivity', label='Conductivity',
                 editor=UnitScalarEditor()),
            Item('model.pH', label='pH', editor=UnitScalarEditor()),
            VGroup(
                Item('product_assays', show_label=False,
                     editor=build_assay_list_editor(assay_names)),
                VGroup(
                    VGroup(
                        Item("_strip_desc", editor=LabelWithHyperlinks(),
                             style="readonly", show_label=False,
                             resizable=True)
                    ),
                    Item('model.strip_mass_fraction',
                         editor=UnitScalarEditor(), style="readonly"),
                    visible_when="_has_strip"),
                label='Product assay fractions', show_border=True,
            ),
            VGroup(
                Item('chemical_components', show_label=False,
                     editor=build_chemical_component_editor(component_names)),
                label='Chemical Components', show_border=True,
            ),
            # Relevant when used as standalone view only:
            resizable=True, buttons=OKCancelButtons, width=400,
            title="Configure the solution"
        )
        return view
Exemple #6
0
    def default_traits_view(self):
        view = View(Tabbed(
            VGroup(Item("model.name", label="System Name"),
                   Item("model.system_number", label="System ID"),
                   Item("model.abs_path_length",
                        editor=UnitScalarEditor(),
                        label="Absorbance Detector Path Length"),
                   Item("model.holdup_volume", editor=UnitScalarEditor()),
                   label="System in use"),
            VGroup(Item("_system_type_view",
                        editor=InstanceEditor(),
                        style="custom",
                        show_label=False,
                        enabled_when="_allow_type_editing"),
                   label="System type"),
        ),
                    buttons=OKCancelButtons)

        return view
    def default_traits_view(self):
        view = View(
            Item("model.name", label="Resin Name"),
            Item("model.resin_type", label="Resin Type"),
            Item("model.lot_id", label="Resin Lot ID"),
            Item("model.average_bead_diameter",
                 label="Avg. Bead Diameter",
                 editor=UnitScalarEditor()),
            Item("model.ligand_density",
                 label="Ligand Density",
                 editor=UnitScalarEditor()),
            Item("model.settled_porosity",
                 label="Settled Porosity",
                 editor=UnitScalarEditor()),

            # Relevant when used as standalone view:
            resizable=True,
            buttons=OKCancelButtons,
            title="Configure component")
        return view
Exemple #8
0
    def default_traits_view(self):
        known_component_names = [comp.name for comp in self.known_components]
        buff_comp_editor = build_buffer_component_table_editor(
            known_component_names)

        view = View(
            Item('model.name'),
            Item('model.pH', label='pH', editor=UnitScalarEditor()),
            Item('model.conductivity',
                 label='Conductivity',
                 editor=UnitScalarEditor()),
            VGroup(
                Item('buffer_components',
                     editor=buff_comp_editor,
                     label='Buffer Components')),
            # Relevant when used as standalone view:
            resizable=True,
            buttons=OKCancelButtons,
            title="Configure buffer")
        return view
 def default_traits_view(self):
     view = View(VGroup(
         Item("model.name"),
         Item("model.manufacturer", label="Manufacturer"),
         Item("model.manufacturer_name", label="Manufacturer Model"),
         Item("model.num_inlets", label="Number of Inlets"),
         Item("model.num_channels", label="Number of Channels"),
         HGroup(
             Item("system_type_flow_range_min",
                  editor=UnitScalarEditor(),
                  label="Min Flow"),
             Item("system_type_flow_range_max",
                  editor=UnitScalarEditor(),
                  label="Max Flow"),
         ),
         label="System Type",
         show_border=True,
     ),
                 buttons=OKCancelButtons)
     return view
    def default_traits_view(self):
        view = KromView(
            Item("model.name",
                 tooltip=COMPONENT_NAME_TOOLTIP,
                 editor=TextEditor(invalid='_invalid_name'),
                 enabled_when='name_editable'),
            Item("model.target_product",
                 enabled_when="target_product_editable"),
            Item("model.extinction_coefficient",
                 editor=UnitScalarEditor(),
                 width=200),
            Item("model.molecular_weight",
                 editor=UnitScalarEditor(),
                 tooltip="Molecular weight of the component in kilo-Daltons "
                 "(1 kDa=1 kg/mol)"),

            # Relevant when used as standalone view:
            buttons=OKCancelButtons,
            title=self.title)

        return view
def build_performance_data_table_editor():
    """ Build a table editor to display a list of PerformanceParameters of
    Simulations modeling the provided product.
    """
    pool_conc_tooltip = 'Sum of concentration of all product components'
    purity_tooltip = 'Purities (c_comp/c_all_comps * 100) of all product ' \
                     'components.'

    columns = [
        ObjectColumn(name='name',
                     label='Simulation Name',
                     editor=NoAutoTextEditor()),
        UnitScalarColumn(name='start_collect_time',
                         label='Start Collect Time',
                         editor=UnitScalarEditor()),
        UnitScalarColumn(name='stop_collect_time',
                         label='Stop Collect Time',
                         editor=UnitScalarEditor()),
        UnitScalarColumn(name='pool_volume',
                         label='Pool Volume',
                         editor=UnitScalarEditor()),
        UnitScalarColumn(name='step_yield',
                         label='Yield',
                         editor=UnitScalarEditor()),
        UnitScalarColumn(name='pool_concentration',
                         label='Pool Concentration',
                         tooltip=pool_conc_tooltip,
                         editor=UnitScalarEditor()),
        ObjectColumn(name='pool_purities',
                     label='Pool Product Component Purities',
                     tooltip=purity_tooltip),
    ]

    editor = TableEditor(columns=columns,
                         deletable=False,
                         auto_size=True,
                         sortable=True,
                         editable=False)
    return editor
 def default_traits_view(self):
     view = View(
         VGroup(
             Item("model.name", label="Column Model"),
             Item("model.manufacturer", label="Column Manufacturer"),
             Item("model.manufacturer_name",
                  label="Manufacturer Model Number"),
             Item("model.diameter",
                  label="Column Diameter",
                  editor=UnitScalarEditor()),
             Item("column_type_bed_height_min",
                  editor=UnitScalarEditor(),
                  label="Min Bed Height"),
             Item("column_type_bed_height_max",
                  editor=UnitScalarEditor(),
                  label="Max Bed Height"),
             Item("model.bed_height_adjust_method",
                  label="Bed Height Adjustment Method"),
         ),
         # Relevant when used as standalone view:
         resizable=True,
         buttons=OKCancelButtons,
         title="Configure Column Type")
     return view
Exemple #13
0
def build_chemical_component_editor(known_component_names):
    """ Build a table editor to display a list of chemical components.
    """
    if known_component_names:
        row_factory = ChemicalComponent
        default_name = known_component_names[0]
    else:
        row_factory = False
        default_name = ""

    editor = TableEditor(
        columns=[
            ObjectColumn(name='name',
                         editor=EnumEditor(values=known_component_names)),
            UnitScalarColumn(name='concentration', editor=UnitScalarEditor())
        ],
        editable=True,
        sortable=False,
        deletable=True,
        row_factory=row_factory,
        row_factory_kw={"name": default_name},
    )
    return editor
Exemple #14
0
    def default_traits_view(self):
        known_component_names = [comp.name for comp in self.known_components]
        chem_comp_editor = build_chemical_component_table_editor(
            known_component_names)

        # FIXME: How do we want to 'create' this object in the UI?
        # i.e. what traits should be editable and what should be read only

        # Note: Current traits not in view of Chemical are 'component_list',
        # and 'component_atom_counts' which will be picked up by Tree
        view = View(Item('model.name'),
                    Item('model.state'),
                    Item('model.formula', style='readonly'),
                    Item('model.molecular_weight',
                         label='Molecular Weight',
                         editor=UnitScalarEditor()),
                    VGroup(
                        Item('chemical_components',
                             editor=chem_comp_editor,
                             label='Chemical Components')),
                    resizable=True,
                    buttons=OKCancelButtons,
                    title="Configure Chemical")
        return view
    def default_traits_view(self):
        landing_text = r"Strip contribution estimation for Experiment " \
                       r"'<i>{}</i>' (load '<i>{}</i>'), from the specified " \
                       r"load concentration, method step <br>start times and "\
                       r"estimated product extinction coefficient:"
        landing_text = landing_text.format(self.model.experim.name,
                                           self._load_solution_name)
        formula = "strip_fraction = 1 - mass_eluting_before_strip / " \
                  "loaded_mass"

        view = KromView(
            VGroup(
                VGroup(Label(landing_text),
                       HGroup(
                           Spring(),
                           Label(formula),
                           Spring(),
                       ),
                       show_border=True),
                VGroup(HGroup(
                    VGroup(
                        Item("object.model.load_concentration",
                             editor=UnitScalarEditor()),
                        Item("object.model.loaded_volume",
                             editor=UnitScalarEditor())),
                    Spring(),
                    VGroup(
                        Spring(),
                        Item("object.model.loaded_mass",
                             editor=UnitScalarEditor(),
                             style="readonly"),
                        Spring(),
                    ),
                ),
                       show_border=True,
                       label="Product loaded into the column"),
                HGroup(VGroup(
                    Item("object.model.product_ext_coeff",
                         editor=UnitScalarEditor(),
                         label="Est. product extinction coef."),
                    Item("object.model.load_start",
                         label="Load start time",
                         editor=UnitScalarEditor()),
                    Item("object.model.strip_start",
                         label="Strip start time",
                         editor=UnitScalarEditor()),
                ),
                       Spring(),
                       VGroup(
                           Spring(),
                           Item("object.model.integrated_mass_before_strip",
                                label="Mass eluting before strip",
                                editor=UnitScalarEditor(),
                                style="readonly"), Spring()),
                       show_border=True,
                       label="Product recovered before Strip"),
                HGroup(
                    Spring(),
                    Item("object.model.strip_mass_fraction",
                         editor=UnitScalarEditor(),
                         label="Proposed Strip Mass Fraction"),
                    Item("_current_strip_mass_fraction",
                         editor=UnitScalarEditor(),
                         style="readonly",
                         label="Current Strip Mass Fraction"), Spring()),
            ),
            title="Strip Fraction Estimation Assistant",
            buttons=[ResetButton, ApplyButton],
            handler=StripFractionCalculatorHandler(),
        )
        return view
Exemple #16
0
    def traits_view(self):
        col_pattern_editor = build_col_name_editor(self.all_col_names)
        filename = basename(self.akta_filepath)
        spinner_editor = RangeEditor(low=5, high=9999, mode='spinner')
        time_orig = 'AKTA time from which to import AKTA data and name' \
                    ' of the corresponding step (typically the load).'
        search_instructions = 'Hit {}-f to search for a word'
        search_instructions = search_instructions.format(get_ctrl())

        view = KromView(
            Tabbed(
                VGroup(
                    VGroup(
                        Label(time_orig),
                        HGroup(
                            Item('time_of_origin', editor=UnitScalarEditor(),
                                 show_label=False),
                            Item("akta_start_method_step",
                                 label="Method step @ t=0"),
                        ),
                        Item('origin_error_msg', emphasized=True,
                             visible_when='origin_error_msg',
                             style='readonly', label="Note"),
                        show_border=True, label="Time of origin"
                    ),
                    VGroup(
                        Item('patterns_as_list', editor=col_pattern_editor,
                             show_label=False, height=200),
                        Item('pattern_error_msg', emphasized=True,
                             visible_when='pattern_error_msg',
                             style='readonly', label="Error"),
                        show_border=True, label="AKTA Column Types"
                    ),
                    label="AKTA File Settings"
                ),
                VGroup(
                    Item('file_preview', editor=CodeEditor(),
                         show_label=False, tooltip=search_instructions),
                    VGroup(Item('length_of_preview', editor=spinner_editor)),
                    show_border=True,
                    label="AKTA File Preview".format(filename),
                ),
                VGroup(
                    # Information used to evaluate the loaded product mass
                    Item("mass_bal_analyzer", editor=InstanceEditor(),
                         style="custom", show_label=False),
                    VGroup(
                        HGroup(
                            Item("mass_bal_msg", emphasized=True,
                                 style='readonly', show_label=False),
                        ),
                        Item("mass_bal_strategy",
                             label="Adjustment strategy",
                             enabled_when="not mass_balanced"),
                        HGroup(
                            Item("mass_bal_strategy_msg", emphasized=True,
                                 style='readonly', show_label=False,
                                 enabled_when="not mass_balanced"),
                        ),
                        visible_when="target_experiment and pure_protein_exp"
                    ),
                    label="UV and Mass Balance",
                ),
            ),
            buttons=OKCancelButtons,
            title="Experiment Importer: {}".format(self.experiment_name),
            width=900,
        )

        return view
Exemple #17
0
    def traits_view(self):
        component_descr_simple_editor = build_component_descr_editor(False)
        component_descr_expert_editor = build_component_descr_editor(True)
        known_products = self.datasource.get_object_names_by_type('products')
        name_editor = TextWithExcludedValuesEditor(
            forbidden_values=set(known_products)
        )
        expert_mode_tooltip = "Expert mode: customize assay names, and " \
                              "control concentration expressions."

        strip_label = 'Strip component, automatically added to account for' \
                      ' load mass eluting during the Strip step, if any.'
        view = KromView(
            VGroup(
                HGroup(
                    Item('name', editor=name_editor, width=300),
                    Item('product_type'),
                ),
                Item("description", style="custom"),
                Item('pI', editor=UnitScalarEditor(), label="pI"),
                HGroup(
                    Spring(),
                    Item('expert_mode', tooltip=expert_mode_tooltip),
                ),
                VGroup(
                    Item('component_descs', show_label=False,
                         editor=component_descr_simple_editor),
                    Item('_add_comp_button', show_label=False),
                    HGroup(
                        Spring(),
                        Item('add_strip', tooltip=expert_mode_tooltip),
                    ),
                    VGroup(
                        Label(strip_label),
                        HGroup(
                            Item('strip_component_descs', style='readonly',
                                 editor=component_descr_simple_editor,
                                 show_label=False, height=40),
                            Item('_edit_strip_comp_button', show_label=False),
                        ),
                        visible_when="add_strip"
                    ),
                    label="Product component names",
                    show_border=True, visible_when="not expert_mode"
                ),
                VGroup(
                    Item('component_descs', show_label=False,
                         editor=component_descr_expert_editor,
                         visible_when="expert_mode"),
                    Item('_add_comp_button', show_label=False),
                    label="Product components and concentration expressions",
                    show_border=True, visible_when="expert_mode"
                ),
                VGroup(
                    Item('component_assay_names', editor=ASSAY_TABLE_EDITOR,
                         show_label=False),
                    Item("_add_assay_button", show_label=False),
                    label="Component assay values",
                    show_border=True, visible_when="expert_mode"
                ),
            ),
            width=600, height=600, title="Specify New Product Characteristics",
            buttons=OKCancelButtons
        )
        return view
    def default_traits_view(self):
        bed_height_actual_tooltip = ("Must be within the range set by the "
                                     "Column Type")
        bed_height_actual_label = "Bed Height"
        col_type_bed_height_set = (self.model.column_type is not None
                                   and self.model.column_type.bed_height_range
                                   is not None)
        if col_type_bed_height_set:
            height_range = self.model.column_type.bed_height_range.tolist()
            bed_height_actual_tooltip += ": {}.".format(height_range)

            # bed_height_units = self.model.column_type.bed_height_range.units
            # bed_height_actual_label += " ({})".format(bed_height_units.label)

        hetp_tooltip = "Height Equivalent to a Theoretical Plate (HETP)"
        compress_factor_tooltip = "Compression Factor (settled vol/packed vol)"

        view = View(
            VGroup(
                Item("model.name", label="Column Name"),
                Item("model.column_lot_id", label="Column Lot ID"),
                Item("model.bed_height_actual",
                     label=bed_height_actual_label,
                     editor=UnitScalarEditor(),
                     tooltip=bed_height_actual_tooltip),
                Item("model.volume",
                     editor=UnitScalarEditor(),
                     style="readonly"),
                Item("model.compress_factor",
                     label="Compression Factor",
                     editor=UnitScalarEditor(),
                     tooltip=compress_factor_tooltip),
                Item("model.hetp",
                     label="HETP",
                     editor=UnitScalarEditor(),
                     tooltip=hetp_tooltip),
                Item("model.hetp_asymmetry",
                     label="HETP Asymmetry",
                     editor=UnitScalarEditor()),
                label="Packed Column",
                show_border=True,
            ),
            VGroup(
                Item("column_type_view",
                     editor=InstanceEditor(),
                     style="custom",
                     show_label=False),
                label="Column Type",
                show_border=True,
            ),
            VGroup(Item("resin_view",
                        editor=InstanceEditor(),
                        style="custom",
                        show_label=False),
                   label="Resin",
                   show_border=True),
            # Relevant when used as standalone view:
            resizable=True,
            buttons=OKCancelButtons,
            title="Configure column")

        return view