def Ex3Chapitre2_8_9():
    """Provides the correction of exercise 3 of notebook 2_8_9
    """

    a_1 = widgets.Checkbox(
        value=False,
        description=r'La matrice $A_1$ admet une décomposition LU.',
        disabled=False,
        layout=Layout(width='80%', height='30px'))

    a_2 = widgets.Checkbox(
        value=False,
        description=r'La matrice $A_2$ admet une décomposition LU.',
        disabled=False,
        layout=Layout(width='80%', height='30px'))

    a_3 = widgets.Checkbox(
        value=False,
        description=r'La matrice $A_3$ admet une décomposition LU.',
        disabled=False,
        layout=Layout(width='80%', height='30px'))

    def correction(a_1, a_2, a_3):
        if not a_1 and a_2 and not a_3:
            display(
                Latex(
                    "C'est correct! Plus précisément, la matrice $A_1$ n'admet pas de décomposition LU car elle n'est pas inversible, la matrice $A_2$ admet décomposition LU et la matrice $A_3$ n'admet pas décomposition LU car elle ne peut pas être réduite sans échanger deux lignes pendant la méthode d'élimination de Gauss"
                ))
        else:
            display(Latex("C'est faux."))

    interact_manual(correction, a_1=a_1, a_2=a_2, a_3=a_3)

    return
예제 #2
0
파일: utils.py 프로젝트: roriola/bootcamp
def sgd_simple_lr_dataset_demo():
    random_state = check_random_state(10)

    x, y = make_regression(n_features=1,
                           n_samples=100,
                           noise=30.5,
                           random_state=random_state,
                           bias=200)
    x = pd.Series(x[:, 0])
    y /= 100
    y *= 2.0
    y = pd.Series(y)

    params = {'b0': -1, 'b1': -5, 'path': []}

    interact_manual(run_multiple_sgd_iter_for_simple_lr,
                    x=fixed(x),
                    y=fixed(y),
                    random_state=fixed(random_state),
                    params=fixed(params),
                    n_iter=FloatSlider(min=1, max=100, step=1, value=1),
                    learning_rate=FloatSlider(min=0.01,
                                              max=2.0,
                                              step=0.01,
                                              value=0.01))
예제 #3
0
 def show_controller(self, wait=True):
     linkage = self
     param_names = list(self.get_param_dict().keys())
     if param_names:
         self.param_name_widget = widgets.Dropdown(options=param_names,
                                                   value=param_names[0])
         param = self.get_parameter(param_names[0])
         self.value_widget = widgets.FloatSlider(min=param.min,
                                                 max=param.max,
                                                 step=self.step_size,
                                                 value=param.tensor.item())
     else:
         self.param_name_widget = widgets.Dropdown(options=[''], value='')
         self.value_widget = widgets.FloatSlider(min=0,
                                                 max=1,
                                                 step=self.step_size,
                                                 value=0)
     self.param_name_widget.observe(self.update_param_bounds, 'value')
     if wait:
         interact_manual(linkage.set_parameter,
                         full_param_name=self.param_name_widget,
                         value=self.value_widget)
     else:
         interact(linkage.set_parameter,
                  full_param_name=self.param_name_widget,
                  value=self.value_widget)
예제 #4
0
def interact_animate_figs(figs, manual=False, TextInput=False):
    """
    Create an interact that loops over all the frames contained in a list of figures.

    Passing in the argument `manual=True` will use the widget `interact_manual`
    instead of `interact`.  This refrains from updating the image as you move
    the slider bar.  Instead you move the slider as desired and then click on
    the `Run` button to re-display the image.  This is useful if there are many
    frames and you want to be able to jump to around without all the
    intermediate frames being displayed, which can slow down the response
    significantly.

    The argument `TextInput=True` can be specified to produce a text input cell
    rather than a slider bar.
    """

    def display_frame(frameno):
        display(figs[frameno])

    if TextInput:
        widget = ipywidgets.IntText(min=0,max=len(figs)-1, value=0)
    else:
        widget = ipywidgets.IntSlider(min=0,max=len(figs)-1, value=0)

    if manual:
        if TextInput:
            print("Valid frameno values: from %i to %i" % (0,len(figs)-1))
        interact_manual(display_frame, frameno=widget)
    else:
        interact(display_frame, frameno=widget)
예제 #5
0
    def run_interaction_continuous_shot(
            self,
            grab_strategy=pylon.GrabStrategy_LatestImageOnly,
            window_size=None,
            image_folder='.'):
        """ Creates Jupyter notebook widgets with all specified features value controls. Push the button 'Run interact'
        to run continuous image grabbing and applying image processing function, if specified. To close openCV windows
        push 'q' button on your keyboard. Press 'S' button to save raw camera image.

        Parameters
        ----------
        grab_strategy : pylon grab strategy
            Pylon image grab strategy
        window_size : tuple (width, height) (optional)
            Size of displaying OpenCV window(raw camera output), if image processing function is not specified.
        image_folder : str
            Path to image folder to save grabbed image
        """
        if self._camera is None or not self._camera.IsOpen():
            raise ValueError("Camera object {} is closed.".format(
                self._camera))

        if window_size is not None and not len(window_size) == 2:
            raise ValueError(
                "Argument 'window_size' has to be None or tuple of length 2.")

        interact_manual(
            self._continuous_interaction_function_wrap(grab_strategy,
                                                       window_size,
                                                       image_folder),
            **self._interact_widgets)
def Ex2Chapitre2_11():
    """Provides the correction of exercise 2 of notebook 2_11
    """
    display(Latex("Insérez votre réponse ici"))
    a = widgets.IntText(value=0, step=1, description='Answer:', disabled=False)

    display(a)

    def f():
        A_tex = "$$ \\qquad \\qquad \\qquad  \\qquad \\qquad \\qquad \\quad" \
                " A = \\left(\\begin{array}{@{}cc|cc|c@{}} " \
                "a_{11} & a_{12} & a_{13} & a_{14} & a_{15} \\\\" \
                " a_{21} & a_{22} & a_{23} & a_{24} & a_{25} \\\\ " \
                "a_{31} & a_{32} & a_{33} & a_{34} & a_{35} \\\\ " \
                "a_{41} & a_{42} & a_{43} & a_{44} & a_{45} " \
                "\\end{array}\\right)$$"

        if a.value == 8:
            display(
                Latex(
                    r"Correct! En effet les colonnes de la matrice A doivent être décomposées comme suit, "
                    r"afin de satisfaire les contraintes de dimensionnalité" +
                    A_tex + r"Ensuite, la décomposition "
                    "en blocs par lignes peut être effectuée dans l'une des $2^{n-1}=8$ possibilités disponibles."
                ))
        else:
            display(
                Latex(
                    r"Incorrect! Aide: Faites attention à la façon dont A doit être décomposé en blocs par "
                    r"colonnes."))

    interact_manual(f)

    return
예제 #7
0
def Ex3Chapitre1_3_4():
    """Provides the correction to exercise 3 of notebook 1_3-4
    """

    print("Cliquer sur CTRL (ou CMD) pour sélectionner plusieurs réponses")

    style = {'description_width': 'initial'}
    res = widgets.SelectMultiple(
        options=['a)', 'b)', 'c)'],
        description='Systèmes avec le même ensemble de solutions:',
        style=style,
        layout=Layout(width='35%', height='170px'),
        disabled=False,
    )

    def correction(res):
        if 'a)' in res and 'c)' in res:
            print("C'est correct!")
            print('Pour le système a), on peut par exemple faire\n')
            sola = '$\\left(\\begin{array}{cc|c} 1 & 1 & 3\\\\ -1& 4 & -1 \\end{array}\\right) \\stackrel{E_{12}}{\sim}\\left(\\begin{array}{cc|c} -1& 4 & -1\\\\ 1 & 1 & 3 \\end{array}\\right)\\stackrel{E_{1}(-2)}{\sim}\\left(\\begin{array}{cc|c} 2& -8 & 2\\\\ 1 & 1 & 3 \\end{array}\\right)$'
            display(Latex(sola))

            print(
                "Pour le système b), les systèmes ne sont pas équivalents. Comme solution on peut exprimer x1 en fonction de x2 et on obtient deux droites (parallèles) de pente 1 mais de hauteurs -2 et 2.$"
            )
            print('Pour le système c), on peut par exemple faire\n')
            sola = '$\\left(\\begin{array}{ccc|c} \dfrac{1}{4} & -2 & 1& 5\\\\ 0& 1 & -1 & 0\\\\ 1 & 2 & -1 & 0 \\end{array}\\right) \\stackrel{E_{1}(4)}{\sim}\\left(\\begin{array}{ccc|c} 1 & -8 & 4& 20\\\\ 0& 1 & -1 & 0\\\\ 1 & 2 & -1 & 0\\end{array}\\right)\\stackrel{E_{31}(-1)}{\sim}\\left(\\begin{array}{ccc|c} 1& -8 & 4&20\\\\ 0 & 1 & -1&0\\\\ 0&10 &-5 & -20\\end{array}\\right)\\stackrel{E_{3}\\big({\\tiny\dfrac{1}{5}}\\big)}{\sim}\\left(\\begin{array}{ccc|c}1& -8 & 4&20\\\\ 0 & 1 & -1&0\\\\ 0&2&-1 & -4\\end{array}\\right)$'
            display(Latex(sola))

        else:
            print("C'est faux. Veuillez rentrer d'autres valeurs")

    interact_manual(correction, res=res)

    return
예제 #8
0
def display_online(predict, gameids, gamepic, gamename):
    def online_recommendations(fav_game1='442',
                               fav_game2='',
                               fav_game3='',
                               fav_game4='',
                               fav_game5='',
                               n_recommendations=(1, 40)):
        gameid_played = []
        for gameid in [fav_game1, fav_game2, fav_game3, fav_game4, fav_game5]:
            try:
                gameid = int(gameid)
                if gameid in gameids:
                    gameid_played.append(gameid)
            except ValueError:
                continue

        # print(gamename[gameids])
        y = np.isin(gameids, gameid_played)
        P = predict(y)

        gameid_similar = gameids[np.argsort(P)[::-1]]
        gameid_similar = [
            gameid for gameid in gameid_similar if gameid not in gameid_played
        ]
        gameid_similar = gameid_similar[:n_recommendations]

        display(HTML("<h4> Games Liked </h4>"))
        d = build_display(gameid_played, gamepic, gamename)
        display(HTML(d))

        display(HTML("<h4> Recommendations </h4>"))
        d = build_display(gameid_similar, gamepic, gamename)
        display(HTML(d))

    interact_manual(online_recommendations)
def Ex3Chapitre2_1():
    """Provides the correction of exercise 3 of notebook 2_1
    """

    a = widgets.Checkbox(value=False,
                         description=r'\(C_{32}\) vaut -14',
                         disabled=False,
                         layout=Layout(width='80%', height='30px'))
    b = widgets.Checkbox(value=False,
                         description=r'\(C_{32}\) vaut 14',
                         disabled=False,
                         layout=Layout(width='80%', height='30px'))
    c = widgets.Checkbox(value=False,
                         description=r'\(C_{32}\) vaut -10',
                         disabled=False,
                         layout=Layout(width='80%', height='30px'))
    d = widgets.Checkbox(value=False,
                         description=r"\(C_{32}\) n'existe pas",
                         disabled=False,
                         layout=Layout(width='80%', height='30px'))

    def correction(a, b, c, d):
        if c and not a and not b and not d:
            display(Latex("C'est correct! La matrice C vaut:"))
            C = [[-6, 64], [-32, -22], [28, -10], [-2, 6]]
            printA(C)
        else:
            display(Latex("C'est faux."))

    interact_manual(correction, a=a, b=b, c=c, d=d)

    return
예제 #10
0
def exercise_intersectingObstacles():
    x_lim, y_lim = [-16, 16], [-2, 18]

    # Interactive Widgets
    n_obs_widget = widgets.Dropdown(
        options=[2, 3, 4],
        value=2,
        description='#',
        disabled=False,
    )

    print("Choose the number of obstacles:")

    WidgetClass = WidgetClass_intersection(x_lim=x_lim, y_lim=y_lim)
    interact(choose_obstacles_number,
             n_obstacles=n_obs_widget,
             WidgetClass=fixed(WidgetClass),
             x_lim=fixed(x_lim),
             y_lim=fixed(y_lim))

    check_vectorfield = widgets.Checkbox(value=False,
                                         description='Draw Vectorfield',
                                         disabled=False)

    interact_manual(WidgetClass.update, check_vectorfield=check_vectorfield)
def preview_parameters_get_store_parameters_buttons(step, index, parameters_update):
    print(f'Do you want to set the following new parameters: \n {parameters_update} \n specific for the following data?')
    # Define toggle button widgets for mouse-, session- and trial-specific parameter storing
    mouse_specific_widget = widgets.ToggleButton(value=True, description=f'Mouse: {index[0]}')
    session_specific_widget = widgets.ToggleButton(value=True, description=f'Session: {index[1]}')
    trial_name = src.pipeline.get_trial_name(index[2],index[3])
    trial_specific_widget = widgets.ToggleButton(value=True, description=f'Trial: {trial_name}')
    # Store the widgets in a list
    widget_list = [mouse_specific_widget, session_specific_widget, trial_specific_widget]
    # Define the updating function to enforce the rule: if parameters are stored 
    # level-specific for a certain level, they are specific for all upper levels as well
    def update_values(*args):
        for i, indexer in enumerate(src.pipeline.data_structure[:3]):
            value_list = [widget.value for widget in widget_list[i+1:]]
            if np.array(value_list).any():
                widget_list[i].value = True
    # Apply the update_values function as an observer for each widget
    for widget in widget_list: widget.observe(update_values, 'value')
    # Display the widgets
#    for widget in widget_list: display(widget)
    # Create a button for storing parameters
#    store_parameters = widgets.Button(description = 'Store parameters') ; display(store_parameters)
    # Define a wrapper function for the button
    def f_store_parameters(mouse_specific, session_specific, trial_specific):
        mouse = index[0] if mouse_specific else None
        session = index[1] if session_specific else None
        trial = index[2] if trial_specific else None
        is_rest = index[3] if trial_specific else None 
        src.pipeline.set_parameters(step, parameters_update, mouse, session, trial, is_rest, check = False)
    
    interact_manual(f_store_parameters, mouse_specific = mouse_specific_widget, session_specific = session_specific_widget,
                    trial_specific = trial_specific_widget)
예제 #12
0
 def _display_interact(self,
                       explainer: Explainer,
                       explain_instance: Optional[bool] = False) -> None:
     """
     Set up and display interact dialog with given explainer
     :param explainer: Explainer instance that will be used
     :param explain_instance: if true Explainer.explain_instance will be called and the dialog will be created with
     'Explained instance' tab, otherwise Explainer.explain_model will be called and no 'Explained instance' tab will
     be created
     :return: None
     """
     options_map, options_grid = explainer.build_options()
     if explain_instance:
         instance_widget_list, instance_creation_grid = self._build_instance_creation_widgets(
         )
         display(
             self._build_tabs(resources=explainer.resources,
                              options_box=options_grid,
                              instance_creation=instance_creation_grid))
         interact_manual(self._build_instance_and_call,
                         options=fixed(options_map),
                         call=fixed(explainer.explain),
                         instance_widgets=fixed(instance_widget_list))
     else:
         display(
             self._build_tabs(resources=explainer.resources,
                              options_box=options_grid))
         interact_manual(self._build_instance_and_call,
                         options=fixed(options_map),
                         call=fixed(explainer.explain),
                         instance_widgets=fixed(None))
예제 #13
0
def display_online_questions(predict, gameids, gamepic, gamename, itemids,
                             itemname):

    question_widgets = OrderedDict()
    for itemid in itemids:
        question_widgets[itemid] = widgets.IntSlider(
            min=-2,
            max=2,
            step=1,
            value=0,
            description=itemname[itemid],
            style={'description_width': '400px'},
            layout={'width': '600px'})
    question_widgets['n_recommendations'] = widgets.IntSlider(
        min=1, max=40, step=1, value=20, description='n_recommendations')

    def online_recommendations(**kwargs):
        n_recommendations = kwargs['n_recommendations']
        answers = np.array([
            kwargs[itemid] for itemid in kwargs
            if itemid != 'n_recommendations'
        ])
        df = pd.DataFrame({'gameid': gameids, 'score': predict(answers)})
        gameids_similar = list(
            df.sort_values('score',
                           ascending=False)['gameid'])[:n_recommendations]

        display(HTML("<h4> Recommendations </h4>"))
        d = build_display(gameids_similar, gamepic, gamename)
        display(HTML(d))

    interact_manual(online_recommendations, **question_widgets)
예제 #14
0
def Ex2Chapitre1_7():
    """Provides the correction to exercise 2 of notebook 1_7
    """

    print("Cliquer sur CTRL pour sélectionner plusieurs réponses")

    style = {'description_width': 'initial'}
    inc = widgets.SelectMultiple(
        options=['a)', 'b)', 'c)', 'd)'],
        description='Incompatibles:',
        style=style,
        layout=Layout(width='15%', height='90px'),
        disabled=False,
    )
    comp = widgets.SelectMultiple(options=['a)', 'b)', 'c)', 'd)'],
                                  description='Compatibles:',
                                  layout=Layout(width='15%', height='90px'),
                                  disabled=False)

    def correction(inc, c):
        if 'a)' in c and 'c)' in c and 'd)' in c and 'b)' in inc:
            print("C'est correct!")
            print(
                "En particulier, les systèmes a) et d) admettent une infinité de solutions, tandis que le système c) "
                "admet une solution unique.")
        else:
            print("C'est faux. Veuillez rentrer d'autres valeurs")

    interact_manual(correction, inc=inc, c=comp)

    return
def Ex2Chapitre2_6_7():
    """Provides the correction to exercise 2 of notebook 2_6-7
    """

    a = widgets.Checkbox(value=False,
                         description=r'$A_1$ est inversible.',
                         disabled=False,
                         layout=Layout(width='80%', height='40px'))
    b = widgets.Checkbox(value=False,
                         description=r'$A_2$ est inversible.',
                         disabled=False,
                         layout=Layout(width='80%', height='40px'))
    c = widgets.Checkbox(value=False,
                         description=r'$A_3$ est inversible.',
                         disabled=False,
                         layout=Layout(width='80%', height='40px'))

    def correction(a, b, c):
        if a and not b and not c:
            A1 = np.array([[2, 0, 1], [0, 6, 4], [2, 2, 1]])
            A1_inv = np.linalg.inv(A1)
            texA1inv = '$' + texMatrix(A1_inv) + '$'
            display(
                Latex(
                    "C'est correct! $A_1$ est la seule matrice inversible et son inverse est: $\quad A_1^{-1} = $"
                    + texA1inv))
        else:
            display(Latex("C'est faux."))

    interact_manual(correction, a=a, b=b, c=c)

    return
예제 #16
0
def exercise_referencePoint():
    x_lim, y_lim = [-16, 16], [-2, 18]

    style = {'description_width': 'initial'}
    # Interactive Widgets
    x1_widget = FloatSlider(description='Obstacle center \( x_1\)',
                            min=x_lim[0],
                            max=x_lim[1],
                            step=0.1,
                            value=6,
                            style=style)
    x2_widget = FloatSlider(description='Obstacle center \( x_2\)',
                            min=y_lim[0],
                            max=y_lim[1],
                            step=0.1,
                            value=5,
                            style=style)
    angle_widget = FloatSlider(description='Obstacle orientation \( \Theta \)',
                               min=-180,
                               max=180,
                               step=1,
                               value=30,
                               style=style)
    referencePoint_direction = FloatSlider(
        description='Reference point: Direction',
        min=-180,
        max=180,
        step=1,
        value=0,
        style=style)
    referencePoint_excentricity = FloatSlider(
        description='Reference point: Excentricity',
        min=0,
        max=0.999,
        step=0.01,
        value=0.0,
        style=style)

    draw_style = widgets.Dropdown(
        options=["None", "Vectorfield", "Simulated streamline"],
        value="Simulated streamline",
        description='Visualization',
        disabled=False,
    )

    # Main function
    interact_manual(widgetFunction_referencePoint,
                    x1=x1_widget,
                    x2=x2_widget,
                    th_r=angle_widget,
                    draw_style=draw_style,
                    refPoint_dir=referencePoint_direction,
                    refPoint_rat=referencePoint_excentricity,
                    x_low=fixed(x_lim[0]),
                    x_high=fixed(x_lim[1]),
                    y_low=fixed(y_lim[0]),
                    y_high=fixed(y_lim[1]))

    print("")
예제 #17
0
    def show_single_cluster_map(self):
        k = widgets.IntSlider(min=2, max=14, continues_update=False)
        n = widgets.IntSlider(min=0, max=13, continues_update=False)

        interact_manual(
            lambda k, n: show_single_map(self.data.joined_data, k, n),
            k=k,
            n=n)
예제 #18
0
 def correction(a, b, c, d):
     if 'Droite' in a and 'Incompatible' in b and 'Point' in c and 'Droite' in d:
         print("C'est correct!")
         print("Sélectionnez le système souhaité et appuyez sur 'Run Interact'"
               " pour visualiser son ensemble de solution(s), le cas échéant")
         interact_manual(plot, c=choice)
     else:
         print("C'est faux. Veuillez rentrer d'autres valeurs")
예제 #19
0
def dice(Nmax=30):

    widgets.interact_manual.opts["manual_name"] = "Roll!"
    widgets.interact_manual(
        dice_,
        N=widgets.IntSlider(description="rolls", min=1, max=Nmax * 5, step=1, value=1),
        Nmax=widgets.fixed(Nmax),
        density=widgets.fixed(0),
    )
예제 #20
0
def manualOp(*args):
    if len(args) == 2:  # matrice augmentée
        A = np.matrix(args[0]).astype(float)
        m = A.shape[0]
        b = args[1]
        #b=[b[i] for i in range(m)]
        if type(b[0]) == list:
            b = np.matrix(b).astype(float)
            A = np.concatenate((A, b), axis=1)
        else:
            b = [b[i] for i in range(m)]
            A = [A[i] + [b[i]] for i in range(0, m)]
    else:
        A = np.matrix(args[0]).astype(float)
        m = A.shape[0]
    A = np.array(A)  #just in case it's not
    j = widgets.BoundedIntText(value=1,
                               min=1,
                               max=m,
                               step=1,
                               description='Ligne j:',
                               disabled=False)
    i = widgets.BoundedIntText(value=1,
                               min=1,
                               max=m,
                               step=1,
                               description='Ligne i:',
                               disabled=False)

    r = widgets.RadioButtons(options=['Eij', 'Ei(alpha)', 'Eij(alpha)'],
                             description='Opération:',
                             disabled=False)

    alpha = widgets.Text(value='1',
                         description='Coeff. alpha:',
                         disabled=False)
    print(
        "Régler les paramètres et cliquer sur RUN INTERACT pour effectuer votre opération"
    )

    def f(r, i, j, alpha):
        m = np.concatenate((A, b), axis=1)
        MatriceList = [A]
        RhSList = [b]
        if alpha == 0:
            print('Le coefficient alpha doit être non-nul!')
        if r == 'Eij':
            m = Eij(m, i - 1, j - 1)
        if r == 'Ei(alpha)':
            m = Ealpha(m, i.value - 1, eval(alpha))
        if r == 'Eij(alpha)':
            m = Eijalpha(m, i - 1, j - 1, eval(alpha))
        MatriceList.append(m[:, 0:len(A[0])])
        RhSList.append(m[:, len(A[0]):])
        printEquMatricesAug(MatriceList, RhSList)

    interact_manual(f, r=r, i=i, j=j, alpha=alpha)
예제 #21
0
    def __init__(self, MetadataObject):
        self.cm = MetadataObject

        # first column:

        # create checkboxes to select the types of graph to plot
        checkboxes_labels = ["Single recording PD with not filtered tonic", \
                             "Single Recording PD with filtered tonic", \
                             "Single Recording PD with sections tonic", \
                             "Overall nawba PD with not filtered tonic", \
                             "Overall nawba PD with filtered tonic", \
                             "Overall nawba PD with sections tonic", \
                             "Average nawba PD with not filtered tonic", \
                             "Avarage nawba PD with filtered tonic",
                             "Avarage nawba PD with sections tonic"]

        self.graphs_checkboxes = list()
        for cb in checkboxes_labels:
            self.graphs_checkboxes.append(
                widgets.Checkbox(value=False, description=cb, indent=False))

        label1 = widgets.Label("Graphs:")
        column1_widgets = [label1] + self.graphs_checkboxes
        column1 = widgets.VBox(column1_widgets)

        # second column:

        # Dropdown menu nawba
        key_list = list()
        values_list = list()
        for row in self.cm.get_dataframe(DF_LISTS[2]).index.tolist():
            key_list.append(
                str(self.cm.convert_id(row, DF_LISTS[2], COLUMNS_NAMES[1])))
            values_list.append(row)
        vals = list(zip(key_list, values_list))
        self.nawba_widget = widgets.Dropdown(options=vals, \
                                       value=values_list[0], layout=widgets.Layout(width='80%'))

        # Dropdown menu alignment
        self.align_dropdown = widgets.Dropdown(options=[("aligned graphs (3 octaves)",0), ("complete graphs", 1)], \
                                          value=1, layout=widgets.Layout(width='80%'))

        # Checkbox folded and unfolded
        self.fold_widget = widgets.Checkbox(value=False,
                                            description="Fold graphs",
                                            indent=False)

        label2 = widgets.Label("Options:")
        column2 = widgets.VBox(
            [label2, self.nawba_widget, self.align_dropdown, self.fold_widget])

        row1 = widgets.HBox([column1, column2])

        display(row1)  #checkboxes_grid, , figure_plot
        widgets.interact_manual(self.plot_tonic_histograms)
예제 #22
0
파일: utils.py 프로젝트: roriola/bootcamp
def non_convex_gradient_descent_demo():
    o = {'curr_x': -6.0}

    interact_manual(run_sgd_step,
                    learning_rate=FloatSlider(min=0.01,
                                              max=2.0,
                                              step=0.01,
                                              value=0.01),
                    o=fixed(o),
                    name=fixed('non-convex-1'),
                    range_def=fixed([-20, 20, 100000]))
예제 #23
0
 def __init__(self, X):
     self.data = X
     self.com = 0
     self.map_proj = ccrs.PlateCarree()
     self.interactive_fig = plt.figure(figsize = (14,6))
     #self.interactive_ax = plt.axes(projection=self.map_proj)
     
     ipywidgets.interact_manual(self.update, component_number = ipywidgets.IntSlider(value=0,
                                            min=0,
                                            max=X.shape[0]-1,
                                            step=1,  continuous_update=False,))
예제 #24
0
 def y(self):
     interact_manual(self.Y,
                     day=widgets.IntSlider(min=1,
                                           max=365,
                                           step=1,
                                           value=180),
                     hour=widgets.IntSlider(min=0, max=23, step=1,
                                            value=12),
                     ii=widgets.IntSlider(min=0,
                                          max=self.nx - 1,
                                          step=1,
                                          value=0))
예제 #25
0
 def map(self):
     interact_manual(self.MAP,
                     day=widgets.IntSlider(min=1,
                                           max=365,
                                           step=1,
                                           value=180),
                     hour=widgets.IntSlider(min=6, max=20, step=1,
                                            value=12),
                     Lmax=widgets.IntSlider(min=0,
                                            max=35000,
                                            step=100,
                                            value=5000))
예제 #26
0
 def x(self):
     interact_manual(self.X,
                     day=widgets.IntSlider(min=1,
                                           max=365,
                                           step=1,
                                           value=180),
                     hour=widgets.IntSlider(min=0, max=23, step=1,
                                            value=12),
                     jj=widgets.IntSlider(min=0,
                                          max=self.ny - 1,
                                          step=1,
                                          value=0))
예제 #27
0
def Ex3Chapitre1_7():
    """Provides the correction of exercise 3 of notebook 1_7
    """

    systa = widgets.Select(
        options=['Point', 'Droite', 'Plan', 'Incompatible'],
        description='Système a):',
        disabled=False,
    )
    systb = widgets.Select(
        options=['Point', 'Droite', 'Plan', 'Incompatible'],
        description='Système b):',
        disabled=False
    )
    systc = widgets.Select(
        options=['Point', 'Droite', 'Plan', 'Espace', 'Incompatible'],
        description='Système c):',
        disabled=False
    )
    systd = widgets.Select(
        options=['Point', 'Droite', 'Plan', 'Espace', 'Incompatible'],
        description='Système d):',
        disabled=False
    )
    choice = widgets.Dropdown(
        options=['a)', 'b)', 'c)', 'd)'],
        value='a)',
        description='Système:',
        disabled=False,
    )

    def plot(c):
        if c == 'a)':
            drawLine([[0], [0]], [[4], [1]])
        if c == 'b)':
            print("Le système est incompatible, donc il n'y a pas de solutions")
        if c == 'c)':
            drawLine([[-17], [5], [-10]], [[0], [0], [0]])
        if c == 'd)':
            drawLine([[1], [0], [0]], [[0], [-1], [1]])

    def correction(a, b, c, d):
        if 'Droite' in a and 'Incompatible' in b and 'Point' in c and 'Droite' in d:
            print("C'est correct!")
            print("Sélectionnez le système souhaité et appuyez sur 'Run Interact'"
                  " pour visualiser son ensemble de solution(s), le cas échéant")
            interact_manual(plot, c=choice)
        else:
            print("C'est faux. Veuillez rentrer d'autres valeurs")

    interact_manual(correction, a=systa, b=systb, c=systc, d=systd)

    return
def Ex2Chapitre2_4():
    """Provides the correction to exercise 3 of notebook 2_4
    """

    a = widgets.Checkbox(
        value=False,
        description=
        r"Le système admet une solution unique seulement si $\alpha < 2$.",
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    b = widgets.Checkbox(
        value=False,
        description=
        r"Le système admet une unique solution seulement si $\alpha \geq 2$.",
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    c = widgets.Checkbox(
        value=False,
        description=
        r'Le système admet une unique solution $\forall \alpha \in \mathbb{R}.$',
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    d = widgets.Checkbox(
        value=False,
        description=
        r"Le système n'admet aucune solution si $\alpha < 2$, alors qu'il admet une solution unique si "
        r"$\alpha \geq 2.$",
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    e = widgets.Checkbox(
        value=False,
        description=
        r"Le système admet plusieurs solutions si $\alpha \neq 2$, alors qu'il admet une solution unique si"
        r" $\alpha = 2$.",
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    f = widgets.Checkbox(
        value=False,
        description=
        r"Le système n'admet jamais de solutions uniques, quelle que soit  $\alpha \in \mathbb{R}$.",
        disabled=False,
        layout=Layout(width='80%', height='40px'))

    def correction(a, b, c, d, e, f):
        if f and not a and not b and not c and not d and not e:
            display(Latex("C'est correct!"))
        else:
            display(Latex("C'est faux."))

    interact_manual(correction, a=a, b=b, c=c, d=d, e=e, f=f)

    return
def Ex1Chapitre2_4():
    """Provides the correction to exercise 2 of notebook 2_4
    """

    a = widgets.Checkbox(
        value=False,
        description=r'Le système admet une solution unique et elle est:'
        r'$$\qquad \qquad x = \begin{pmatrix} 1&4/3&4/3\end{pmatrix}^T.$$',
        disabled=False,
        layout=Layout(width='50%', height='70px'))
    b = widgets.Checkbox(value=False,
                         description=r"Le système n'admet aucune solution.",
                         disabled=False,
                         layout=Layout(width='50%', height='20px'))
    c = widgets.Checkbox(
        value=False,
        description=r'Le système admet une solution unique et elle est:'
        r'$$\qquad \qquad x = \begin{pmatrix} 1&4/3&8/3\end{pmatrix}^T.$$',
        disabled=False,
        layout=Layout(width='50%', height='70px'))
    d = widgets.Checkbox(value=False,
                         description=r'Le système admet plusieurs solutions.',
                         disabled=False,
                         layout=Layout(width='50%', height='20px'))
    e = widgets.Checkbox(
        value=False,
        description=r'$A$ est inversible et son inverse est: <br>'
        r'$$\qquad \qquad A^{-1} = \begin{pmatrix} 1/2&0&1/2\\1/2&-1/3&5/3\\1/2&-2/3&5/6\end{pmatrix}.$$',
        disabled=False,
        layout=Layout(width='50%', height='100px'))

    f = widgets.Checkbox(
        value=False,
        description=r'$A$ est inversible et son inverse est:'
        r'$$\qquad \qquad A^{-1} = \begin{pmatrix} 1/2&0&1/2\\1/2&-1/3&5/3\\1/2&-2/3&-1/2\end{pmatrix}.$$',
        disabled=False,
        layout=Layout(width='50%', height='150px'))
    g = widgets.Checkbox(value=False,
                         description=r"$A$ n'est pas inversible.",
                         disabled=False,
                         layout=Layout(width='50%', height='20px'))

    def correction(a, b, c, d, e, f, g):
        if c and e and not a and not b and not d and not f and not g:
            display(Latex("C'est correct!"))
        else:
            display(Latex("C'est faux."))

    interact_manual(correction, a=a, b=b, c=c, d=d, e=e, f=f, g=g)

    return
def Ex1aChapitre2_5():
    """Provides the correction to exercise 1a of notebook 2_5
    """

    a = widgets.Checkbox(
        value=False,
        description=
        r'\(E_1E_2\) multiplie la ligne 4 par -6 et échange les lignes 2 et 3.',
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    b = widgets.Checkbox(
        value=False,
        description=
        r'\(E_1E_2\) ajoute 6 fois la ligne 4 à la ligne 2 et échange les lignes 1 et 3.',
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    c = widgets.Checkbox(
        value=False,
        description=
        r'\(E_1E_2\) échange les lignes 1 et 3 et ajoute -6 fois la ligne 4 à la ligne 2.',
        disabled=False,
        layout=Layout(width='80%', height='40px'))
    d = widgets.Checkbox(
        value=False,
        description=
        r"\(E_1E_2\) ajoute -6 fois la ligne 4 à la ligne 2 et échange les lignes 1 et 2.",
        disabled=False,
        layout=Layout(width='80%', height='40px'))

    def correction(a, b, c, d):
        if c and not (a) and not (d) and not (b):
            display(
                Latex(
                    "C'est correct! Par exemple, si on applique le produit à la matrice ci-dessous"
                ))
            A = [[1, -1, 0, 0], [0, 0, 0, 1], [1, 2, 1, 2], [1, 0, 0, 1]]
            B = [[1, 0, 0, 0], [0, 1, 0, -6], [0, 0, 1, 0], [0, 0, 0, 1]]
            C = [[0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]
            BCA = np.linalg.multi_dot([B, C, A])
            texA = '$' + texMatrix(A) + '$'
            texBCA = '$' + texMatrix(BCA) + '$'
            display(Latex('$\qquad A = $' + texA))
            display(Latex("on obtient"))
            display((Latex('$\qquad \hat{A} = $' + texBCA)))
        else:
            display(Latex("C'est faux."))

    interact_manual(correction, a=a, b=b, c=c, d=d)

    return
예제 #31
0
def interact_animate_figs(figs, manual=False, TextInput=False):

    def display_frame(frameno): 
        display(figs[frameno])

    if TextInput:
        widget = ipywidgets.IntText(min=0,max=len(figs)-1, value=0)
    else:
        widget = ipywidgets.IntSlider(min=0,max=len(figs)-1, value=0)

    if manual:
        if TextInput:
            print("Valid frameno values: from %i to %i" % (0,len(figs)-1))
        interact_manual(display_frame, frameno=widget)
    else:
        interact(display_frame, frameno=widget)
예제 #32
0
def interact_animate_images(images, figsize=(10,6), manual=False, TextInput=False):

    def display_frame(frameno): 
        imshow_noaxes(images[frameno], figsize=figsize)

    if TextInput:
        if TextInput:
            print("Valid frameno values: from %i to %i" % (0,len(images)-1))
        widget = ipywidgets.IntText(min=0,max=len(images)-1, value=0)
    else:
        widget = ipywidgets.IntSlider(min=0,max=len(images)-1, value=0)

    if manual:
        interact_manual(display_frame, frameno=widget)
    else:
        interact(display_frame, frameno=widget)
예제 #33
0
파일: pandasw.py 프로젝트: gmatteo/abipy
def plot(data, **kwargs):

    def plot_dataframe(x, y, kind, sharex, sharey, subplots, grid, legend,
                      logx, logy, loglog, colorbar, sort_columns): # pragma: no cover

        x, y = ut.widget2py(x, y)
        sharex, colorbar = ut.str2bool_or_none(sharex, colorbar)
        data.plot(x=x, y=y, kind=kind, subplots=subplots, sharex=None, sharey=sharey,
                layout=None, figsize=None, use_index=True, title=None, grid=grid, legend=legend, style=None,
                logx=logx, logy=logy, loglog=loglog, xticks=None, yticks=None, xlim=None, ylim=None,
                rot=None, fontsize=None, colormap=colorbar, table=False, yerr=None, xerr=None, secondary_y=False,
                sort_columns=sort_columns, **kwargs)
                # There's a typo in the documentation (colorbar/colormap!)
        #import matplotlib.pyplot as plt
        #return plt.gcf()

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                plot_dataframe,
                x=allcols,
                y=allcols,
                sharex=["None", "True", "False"],
                sharey=False,
                kind=["line", "bar", "barh", "hist", "box", "kde", "density", "area", "pie", "scatter", "hexbin"],
                subplots=False,
                grid=True,
                legend=True,
                logx=False,
                logy=False,
                loglog=False,
                colorbar=["None", "True", "False"],
                sort_columns=False,
            )
예제 #34
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def violinplot(data, **kwargs):

    def sns_violinplot(x, y, hue, bw, scale, inner, split, orient, color, saturation): # pragma: no cover
        x, y, hue, inner, orient, color = ut.widget2py(x, y, hue, inner, orient, color)
        ax, fig, _ = ut.get_ax_fig_plt()

        sns.violinplot(x=x, y=y, hue=hue, data=data, order=None, hue_order=None,
                       bw=bw, cut=2, scale=scale, scale_hue=True,
                       gridsize=100, width=0.8, inner=inner, split=split, orient=orient,
                       linewidth=None, color=color, palette=None, saturation=saturation, ax=ax, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_violinplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                bw=["scott", "silverman", "float"],
                scale=["area", "count", "width"],
                inner=["box", "quartile", "point", "stick", "None"],
                split=False,
                orient=["None", "v", "h"],
                color=ut.colors_dropdow(),
                saturation=ut.saturation_slider(default=0.75),
            )
예제 #35
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def clustermap(data, pivot_kws=None, cbar_kws=None, **kwargs):

    def sns_clustermap(): # pragma: no cover
        return sns.clustermap(data, pivot_kws=pivot_kws, method='average', metric='euclidean',
                              z_score=None, standard_scale=None, figsize=None, cbar_kws=cbar_kws,
                              row_cluster=True, col_cluster=True, row_linkage=None, col_linkage=None,
                              row_colors=None, col_colors=None, mask=None, **kwargs)

    return ipw.interact_manual(
                sns_clustermap,
            )
예제 #36
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def heatmap(data, annot_kws=None, cbar_kws=None, **kwargs):

    def sns_heatmap(): # pragma: no cover
        ax, fig, _ = ut.get_ax_fig_plt()
        return sns.heatmap(data, vmin=None, vmax=None, cmap=None, center=None, robust=False, annot=None,
                           fmt='.2g', annot_kws=annot_kws, linewidths=0, linecolor='white', cbar=True,
                           cbar_kws=cbar_kws, cbar_ax=None, square=False, ax=ax,
                           xticklabels=True, yticklabels=True, mask=None, **kwargs)

    return ipw.interact_manual(
                sns_heatmap,
            )
예제 #37
0
파일: bse.py 프로젝트: gmatteo/abipy
    def ipw_select_plot(self): # pragma: no cover
        """
        Return an ipython widget with controllers to select the plot.
        """
        def plot_callback(mdf_type, qview):
            return self.plot(mdf_type=mdf_type, qview=qview)

        import ipywidgets as ipw
        return ipw.interact_manual(
                plot_callback,
                mdf_type=["exc", "rpa", "gwrpa"],
                qview=["avg", "all"],
            )
예제 #38
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def countplot(data, **kwargs):

    def sns_countplot(x, y, hue, color, saturation): # pragma: no cover
        x, y, hue, color = ut.widget2py(x, y, hue, color)
        ax, fig, _ = ut.get_ax_fig_plt()
        return sns.countplot(x=x, y=y, hue=hue, data=data, order=None, hue_order=None, orient=None,
                             color=color, palette=None, saturation=saturation, ax=ax, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_countplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                color=ut.colors_dropdow(),
                saturation=ut.saturation_slider(default=0.75),
            )
예제 #39
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def pairplot(data, plot_kws=None, diag_kws=None, grid_kws=None):
    # TODO: Write widget with multiple checkboxes to implement lists.

    def sns_pairplot(x_vars, y_vars, hue, kind, diag_kind): # pragma: no cover
        x_vars, y_vars, hue = ut.widget2py(x_vars, y_vars, hue)
        return sns.pairplot(data, hue=hue, hue_order=None, palette=None, vars=None, x_vars=x_vars, y_vars=y_vars,
                     kind=kind, diag_kind=diag_kind, markers=None, size=2.5, aspect=1, dropna=True,
                     plot_kws=plot_kws, diag_kws=diag_kws, grid_kws=grid_kws)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_pairplot,
                x_vars=allcols,
                y_vars=allcols,
                hue=allcols,
                kind=["scatter", "ref"],
                diag_kind=["hist", "kde"],
            )
예제 #40
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def jointplot(data, joint_kws=None, marginal_kws=None, annot_kws=None, **kwargs):

    def sns_joinplot(x, y, kind, color):  # pragma: no cover
        x, y, color = ut.widget2py(x, y, color)
        # TODO: stat_func
        return sns.jointplot(x, y, data=data, kind=kind, # stat_func=<function pearsonr>,
                            color=color, size=6, ratio=5, space=0.2, dropna=True, xlim=None, ylim=None,
                            joint_kws=joint_kws, marginal_kws=marginal_kws, annot_kws=annot_kws, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_joinplot,
                x=allcols,
                y=allcols,
                kind=["scatter", "reg", "resid", "kde", "hex"],
                color=ut.colors_dropdow(),
                #button=_help_button("joinplot"),
            )
예제 #41
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def barplot(data, **kwargs):

    def sns_barplot(x, y, hue, orient, color, saturation): # pragma: no cover
        x, y, hue, orient, color = ut.widget2py(x, y, hue, orient, color)
        ax, fig, _ = ut.get_ax_fig_plt()
        return sns.barplot(x=x, y=y, hue=hue, data=data, order=None, hue_order=None, # estimator=<function mean>,
                           ci=95, n_boot=1000, units=None, orient=orient, color=color, palette=None,
                           saturation=saturation, errcolor='.26', ax=ax, **kwargs) # errwidth=None, capsize=None, # New args added in ??

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_barplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                orient=["None", "v", "h"],
                color=ut.colors_dropdow(),
                saturation=ut.saturation_slider(default=0.75),
            )
예제 #42
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def boxplot(data, **kwargs):

    def sns_boxplot(x, y, hue, orient, color, saturation, notch): # pragma: no cover
        x, y, hue, orient, color = ut.widget2py(x, y, hue, orient, color)
        ax, fig, _ = ut.get_ax_fig_plt()
        return sns.boxplot(x=x, y=y, hue=hue, data=data, order=None, hue_order=None, orient=orient,
                          color=color, palette=None, saturation=saturation, width=0.8, fliersize=5, linewidth=None,
                          whis=1.5, notch=notch, ax=ax, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_boxplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                orient=["None", "v", "h"],
                color=ut.colors_dropdow(),
                saturation=ut.saturation_slider(default=0.75),
                notch=False,
            )
예제 #43
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def factorplot(data, facet_kws=None, **kwargs):

    def sns_factorplot(x, y, hue, color, kind, size, legend):  # pragma: no cover
        x, y, hue, color = ut.widget2py(x, y, hue, color)
        return sns.factorplot(x=x, y=y, hue=hue, data=data, row=None, col=None, col_wrap=None, # estimator=<function mean>,
                       ci=95, n_boot=1000, units=None, order=None, hue_order=None, row_order=None, col_order=None,
                       kind=kind, size=size, aspect=1, orient=None, color=color, palette=None,
                       legend=legend, legend_out=True, sharex=True, sharey=True, margin_titles=False,
                       facet_kws=facet_kws, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_factorplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                color=ut.colors_dropdow(),
                kind=["point", "bar", "count", "box", "violin", "strip"],
                size=ut.size_slider(default=4),
                legend=True,
            )
예제 #44
0
파일: wfkfile.py 프로젝트: gpetretto/abipy
    def ipw_visualize_widget(self): # pragma: no cover
        """
        Return an ipython widget with controllers to visualize the wavefunctions.

        .. warning::

            It seems there's a bug with Vesta on MacOs if the user tries to open multiple wavefunctions
            as the tab in vesta is not updated!
        """
        def wfk_visualize(spin, kpoint, band, appname):
            kpoint = int(kpoint.split()[0])
            self.visualize_ur2(spin, kpoint, band, appname=appname)

        import ipywidgets as ipw
        return ipw.interact_manual(
                wfk_visualize,
                spin=list(range(self.nsppol)),
                kpoint=["%d %s" % (i, repr(kpt)) for i, kpt in enumerate(self.kpoints)],
                band=list(range(self.nband)),
                appname=[v.name for v in Visualizer.get_available()],
            )
예제 #45
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def pointplot(data, **kwargs):

    def sns_pointplot(x, y, hue, split, join, orient, color, linewidth): # pragma: no cover
        x, y, hue, orient, color = ut.widget2py(x, y, hue, orient, color)
        ax, fig, _ = ut.get_ax_fig_plt()
        return sns.pointplot(x=x, y=y, hue=hue, data=data, order=None, hue_order=None, # estimator=<function mean>,
                            ci=95, n_boot=1000, units=None, markers='o', linestyles='-', dodge=False, join=join, scale=1,
                            orient=orient, color=color, palette=None, ax=ax, errwidth=None, capsize=None, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_pointplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                split=False,
                join=True,
                orient=["None", "v", "h"],
                color=ut.colors_dropdow(),
                linewidth=ut.linewidth_slider(default=0),
            )
예제 #46
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def swarmplot(data, **kwargs):

    def sns_swarmplot(x, y, hue, split, orient, color, size, linewidth): # pragma: no cover
        x, y, hue, orient, color = ut.widget2py(x, y, hue, orient, color)
        ax, fig, _ = ut.get_ax_fig_plt()
        return sns.swarmplot(x=x, y=y, hue=hue, data=data, order=None, hue_order=None,
                            split=split, orient=orient, color=color, palette=None, size=size,
                            edgecolor='gray', linewidth=linewidth, ax=ax, **kwargs)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_swarmplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                split=False,
                orient=["None", "v", "h"],
                color=ut.colors_dropdow(),
                size=ut.size_slider(default=5),
                linewidth=ut.linewidth_slider(default=0),
            )
예제 #47
0
파일: seabornw.py 프로젝트: gmatteo/abipy
def lmplot(data, scatter_kws=None, line_kws=None):

    def sns_lmplot(x, y, hue, col, row, legend, size):  # pragma: no cover
        x, y, hue, col, row = ut.widget2py(x, y, hue, col, row)

        return sns.lmplot(x, y, data, hue=hue, col=col, row=row, palette=None, col_wrap=None,
                   size=size, aspect=1, markers='o', sharex=True, sharey=True, hue_order=None,
                   col_order=None, row_order=None, legend=legend, legend_out=True,
                   x_estimator=None, x_bins=None, x_ci='ci', scatter=True, fit_reg=True,
                   ci=95, n_boot=1000, units=None, order=1, logistic=False, lowess=False, robust=False,
                   logx=False, x_partial=None, y_partial=None, truncate=False, x_jitter=None, y_jitter=None,
                   scatter_kws=scatter_kws, line_kws=line_kws)

    allcols = ["None"] + list(data.keys())
    return ipw.interact_manual(
                sns_lmplot,
                x=allcols,
                y=allcols,
                hue=allcols,
                col=allcols,
                row=allcols,
                legend=True,
                size=ut.size_slider(default=5),
            )
예제 #48
0
파일: core.py 프로젝트: cniemira/bokehmongo
 def catch(self):
     self._interact = interact_manual(self._throw, velocity=(0.,530., 1.), v_angle=(1.,89., 1.))
     self._interact.widget.children[-1].description = 'Throw Ball'
     print('You have %d seconds to catch %s' % (self._max_time, self))