예제 #1
0
def plot_extraction_s_vs_p(bd):
    names_by_plate = gt.get_names_files_same_plate(bd)

    for lame, _ in sorted(names_by_plate.items()):
        for name in sorted(names_by_plate[lame]):
            bound1 = bd[name]['boundaries']['relaxation_to_elastic']
            bound2 = bd[name]['boundaries']['meniscus_to_breakage']
            position = -1 * (bd[name]['position'][bound1:bound2] -
                             bd[name]['position'][bound1])
            stress = bd[name]['stress'][bound1:bound2]
            plt.plot(position,
                     stress,
                     label=bd[name]['speed'],
                     linestyle='',
                     marker='o',
                     ms=10)
        legend = plt.legend(title='V (mm/s) :', prop={'size': 20}, ncol=2)
        plt.setp(legend.get_title(), fontsize=25)
        plt.xlim(xmax=62)
        plt.xlabel(r'$p$ (mm)')
        plt.ylabel(r'$\tau_p $ (Pa)')
        plt.tight_layout()
        plt.savefig('Contrainte_position_extr_' +
                    bd[name]['file_splitted_name'][0] + '.pdf')
        plt.close()
예제 #2
0
def plot_relaxation_s_vs_t(bd):
    names_by_plate = gt.get_names_files_same_plate(bd)

    for lame, _ in sorted(names_by_plate.items()):
        for name in sorted(names_by_plate[lame]):
            bound1 = bd[name]['boundaries']['arg_force_max']
            bound2 = bd[name]['boundaries']['relaxation_to_elastic']
            time = bd[name]['time'][bound1:bound2] - bd[name]['time'][bound1]
            stress = bd[name]['stress'][bound1:bound2]
            plt.plot(time,
                     stress,
                     label=bd[name]['speed'],
                     linestyle='',
                     marker='o',
                     ms=3)
        legend = plt.legend(title='V (mm/s) :', prop={'size': 11}, ncol=2)
        plt.setp(legend.get_title(), fontsize=13)
        plt.xlabel(r'$t$ (s)')
        plt.ylim(ymin=-0.4, ymax=2.5)
        plt.xlim(xmin=-0.3, xmax=8)
        plt.ylabel(r'$\tau_p $ (Pa)')
        plt.tight_layout()
        plt.savefig('Contrainte_relaxation_' +
                    bd[name]['file_splitted_name'][0] + '.pdf')
        plt.close()
예제 #3
0
def plot_delta_vs_speed_by_plate(bd):
    """
    Saves plots of delta as a function of time by plate -delta being the position difference between the end of the
    relaxation and the beginning of the fluidized regime.

    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves png

    """
    names_by_plate = gt.get_names_files_same_plate(bd)

    for lame, _ in sorted(names_by_plate.items()):
        delta = []
        speed = []
        for name in sorted(names_by_plate[lame]):
            delta += [bd[name]['delta']]
            speed += [bd[name]['speed']]
        plt.plot(speed,
                 delta,
                 marker='o',
                 linestyle='',
                 label=bd[name]['file_splitted_name'][0])
        plt.xlabel(r'$V $(mm/s)')
        plt.ylabel(r'$\delta $(mm)')
        plt.tight_layout()
        plt.savefig('Delta_' + bd[name]['file_splitted_name'][0] + '.pdf')
        plt.close()
예제 #4
0
def ratio_btw_slopes_all_plates(bd):
    """
    Saves plots of the ratio of the slopes btw penetration and fluidized regime

    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves png

    """

    names_by_plate = gt.get_names_files_same_plate(bd)
    dict_plates = gt.get_dict_plates()
    for lame, _ in sorted(names_by_plate.items()):
        speed = []
        ratio = []
        error = []
        lame_number = int(re.findall(r'\d+', lame)[0])
        for name in sorted(names_by_plate[lame]):
            speed += [bd[name]['speed']]
            ratio += [
                -bd[name]['fit_meniscus'][0] / bd[name]['fit_penetration'][0]
            ]
            error += [
                bd[name]['fit_meniscus'][4] / bd[name]['fit_penetration'][0] -
                bd[name]['fit_meniscus'][0] * bd[name]['fit_penetration'][4] /
                (bd[name]['fit_penetration'][0]**2)
            ]

        plt.plot(speed,
                 ratio,
                 label=str(dict_plates[str(lame_number)]),
                 linestyle='',
                 marker='o',
                 ms=10)
        plt.errorbar(speed,
                     ratio,
                     yerr=error,
                     fmt='',
                     marker='',
                     linestyle='none',
                     elinewidth=1,
                     capthick=1,
                     capsize=3,
                     color='gray')
    legend = plt.legend(title=r'$a $ (mm):', prop={'size': 20}, ncol=2)
    plt.setp(legend.get_title(), fontsize=25)
    plt.ylim(ymin=0.99, ymax=1.01)
    plt.xlabel(r'$V $(mm/s)')
    plt.ylabel(r'${\tau_1}/{\tau_2}$')
    plt.tight_layout()
    plt.savefig('Ratio_btw_slopes_all_plates.pdf')
    plt.close()
예제 #5
0
def ratio_by_plate(bd):
    """
    Saves plots of the ratio of the slopes btw penetration and fluidized regime

    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves png

    """

    names_by_plate = gt.get_names_files_same_plate(bd)
    for lame, _ in sorted(names_by_plate.items()):
        speed = []
        ratio = []
        error = []
        for name in sorted(names_by_plate[lame]):
            speed += [bd[name]['speed']]
            ratio += [
                bd[name]['fit_meniscus'][0] / bd[name]['fit_penetration'][0]
            ]
            error += [
                bd[name]['fit_meniscus'][4] / bd[name]['fit_penetration'][0] -
                bd[name]['fit_meniscus'][0] * bd[name]['fit_penetration'][4] /
                (bd[name]['fit_penetration'][0]**2)
            ]
        plt.plot(speed,
                 ratio,
                 label=bd[name]['file_splitted_name'][0],
                 linestyle='',
                 marker='o',
                 ms=6)
        plt.errorbar(speed,
                     ratio,
                     yerr=error,
                     fmt='',
                     marker='',
                     linestyle='none',
                     elinewidth=0.5,
                     capthick=0.5,
                     capsize=1,
                     color='gray')
        legend = plt.legend(title='Lame utilisée :', prop={'size': 11})
        plt.setp(legend.get_title(), fontsize=13)
        plt.xlabel(r'$V $(mm/s)')
        plt.ylabel(r'$\frac{\tau_1}{\tau_2}$')
        plt.ylim(-1.0021, -0.9985)
        plt.savefig('Ratio_btw_slopes_' + bd[name]['file_splitted_name'][0] +
                    '.pdf')
        plt.tight_layout()
        plt.close()
예제 #6
0
def plot_all_velocities(bd):
    """
    Save plots involving all files in *txt in the folder

    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves png

    """
    names_by_plate = gt.get_names_files_same_plate(bd)

    for lame, _ in sorted(names_by_plate.items()):

        for name in sorted(names_by_plate[lame]):
            plt.plot(bd[name]['time'],
                     bd[name]['force'],
                     marker='o',
                     linestyle='-',
                     ms='2',
                     label=bd[name]['speed'])
            plt.legend(title='V (mm/s) :', prop={'size': 11})
        plt.xlabel(r'$t$ (s)')
        plt.ylabel(r'$F$ (mN)')
        plt.minorticks_on()
        name_file = ''.join(
            ['Force_vs_time_varV_', bd[name]['file_splitted_name'][0], '.pdf'])
        plt.savefig(name_file, bbox_inches='tight')
        plt.close()
        for name in sorted(names_by_plate[lame]):
            plt.plot(bd[name]['position'],
                     bd[name]['force'],
                     marker='o',
                     linestyle='-',
                     ms='2',
                     label=bd[name]['speed'])
            plt.legend(title='V (mm/s) :', prop={'size': 11})
        plt.xlabel(r'$p$ (mm)')
        plt.ylabel(r'$F$ (mN)')
        plt.minorticks_on()
        name_file = ''.join([
            'Force_position_varV_', bd[name]['file_splitted_name'][0], '.pdf'
        ])
        plt.savefig(name_file, bbox_inches='tight')
        plt.tight_layout()
        plt.close()
예제 #7
0
def plot_stress_deflexion_point_extraction(bd):
    """
    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves png

    """

    names_by_plate = gt.get_names_files_same_plate(bd)
    dict_plates = gt.get_dict_plates()
    for lame, _ in sorted(names_by_plate.items()):
        speed = []
        ratio = []
        error = []
        min_stress_derivative = []
        lame_number = int(re.findall(r'\d+', lame)[0])
        for name in sorted(names_by_plate[lame]):
            speed += [bd[name]['speed']]
            bound1 = bd[name]['boundaries']['relaxation_to_elastic'] - 10
            bound2 = bd[name]['boundaries']['elastic_to_fluidized']
            time = bd[name]['time'][bound1:bound2]
            sf2 = savgol_filter(bd[name]['stress'][bound1:bound2],
                                9,
                                5,
                                deriv=1,
                                mode='mirror')
            min_stress_derivative += stress[np.argmin(sf2)]
            plt.plot(speed,
                     min_stress_derivative,
                     label=str(dict_plates[str(lame_number)]),
                     linestyle='',
                     marker='o',
                     ms=10)

            legend = plt.legend(title=r'$a $ (mm):', prop={'size': 2}, ncol=2)
            plt.setp(legend.get_title(), fontsize=25)
            plt.ylim(ymin=0.99, ymax=1.01)
            plt.xlabel(r'$V $(mm/s)')
            plt.ylabel(r'$deflexion_stress_$')
            plt.tight_layout()
            plt.savefig('min_stress_derivative_' + name + '.pdf')
            plt.close()
예제 #8
0
def plot_max_force_extraction(bd, variables):
    """
    Saves a plot of all mean stress during penetration period for all velocities

    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves a .pdf

    """

    names_by_plate = gt.get_names_files_same_plate(bd)
    dict_plates = gt.get_dict_plates()
    for lame, _ in sorted(names_by_plate.items()):
        speed = []
        gamma = []
        force_max_corrigee = []
        n = 0
        lame_number = int(re.findall(r'\d+', lame)[0])
        for name in sorted(names_by_plate[lame]):
            speed += [bd[name]['speed']]  # Vitesse en mm/s
            bound = bd[name]['boundaries'][
                'fluidized_to_meniscus']  # Argument correspondant à la force maximale pendant l'extraction
            force_max = bd[name]['force'][bound]  # Force maximale en mN
            force_max_corrigee += [
                abs(force_max - bd[name]['force'][bd[name]['boundaries']
                                                  ['relaxation_to_elastic']])
            ]  # force max moins la valeur à la fin de la relaxation
        plt.plot(speed,
                 force_max_corrigee,
                 linestyle='-',
                 marker='o',
                 ms=10,
                 label=str(dict_plates[str(lame_number)]))
    legend = plt.legend(title='Roughness :', prop={'size': 18}, ncol=2)
    plt.setp(legend.get_title(), fontsize=20)
    plt.xlabel(r'$V$ (mm/s)')
    plt.ylabel(r'$ F_{max}^{IV} $ (mN)')
    plt.tight_layout()
    plt.savefig('Force_max_corrigee_extr' + '.pdf')
    plt.close()
예제 #9
0
def plot_integrale_extraction_by_plate(bd):
    """
    Parameters
    bd : big dictionnary containing all informations about the data files
    -------

    Returns
    -------

    """
    names_by_plate = gt.get_names_files_same_plate(bd)
    dict_plates = gt.get_dict_plates()
    for lame, _ in sorted(names_by_plate.items()):
        lame_number = int(re.findall(r'\d+', lame)[0])
        for name in sorted(names_by_plate[lame]):
            bound1 = bd[name]['boundaries']['relaxation_to_elastic']
            x = -1 * (bd[name]['position'][bound1:] -
                      bd[name]['position'][bound1])
            y = abs(bd[name]['force'][bound1:] - bd[name]['force'][bound1])
            integral = sp.integrate.cumtrapz(y, x, dx=None, initial=0)
            plt.plot(x,
                     integral,
                     linestyle='-',
                     marker='o',
                     ms=5,
                     label=re.sub("[^0-9]", "",
                                  bd[name]['file_splitted_name'][1]))

        legend = plt.legend(title=r'$\vec{V}$ (mm/s):',
                            prop={'size': 22},
                            ncol=2)
        plt.setp(legend.get_title(), fontsize=24)
        plt.xlabel(r'$p$ (mm)')
        plt.ylabel(r'$W^{IV}$ (J)')
        plt.xlim(xmin=-1, xmax=120)
        plt.ylim(ymin=-1, ymax=500)
        plt.text(5, 530,
                 'Roughness: ' + str(dict_plates[str(lame_number)]) + ' mm')
        plt.tight_layout()
        plt.savefig('Intergrale_extraction_' +
                    bd[name]['file_splitted_name'][0] + '.pdf')
        plt.close()
예제 #10
0
def log_plot_relaxation(bd):
    """
    Saves plots of the penetration part. Log plot of the force vs time.

    Parameters
    ----------
    bd : dictionnary
        Dictionnary containing informations about all *.txt files in the folder.

    Returns
    -------
    Nothing, but saves png

    """

    names_by_plate = gt.get_names_files_same_plate(bd)

    for lame, _ in sorted(names_by_plate.items()):

        for name in sorted(names_by_plate[lame]):
            bound1 = bd[name]['boundaries']['arg_force_max']
            bound2 = bd[name]['boundaries']['relaxation_to_elastic']
            time = bd[name]['time'][bound1:bound2] - bd[name]['time'][bound1]
            force = np.asarray(
                bd[name]['force'][bound1:bound2]) / bd[name]['force'][bound1]
            plt.plot(time,
                     force,
                     label=bd[name]['speed'],
                     linestyle='',
                     marker='o',
                     ms=3)
        legend = plt.legend(title=r'$V$ (mm/s) :', prop={'size': 11})
        plt.setp(legend.get_title(), fontsize=13)
        plt.xscale("log")
        plt.yscale("log")
        plt.xlabel(r'$t$ (s)')
        plt.ylabel(r'$ F/F_m$')
        plt.tight_layout()
        plt.savefig('Force_log_relaxation_' +
                    bd[name]['file_splitted_name'][0] + '.pdf')
        plt.close()
예제 #11
0
def plot_penetration_s_vs_t(bd):
    names_by_plate = gt.get_names_files_same_plate(bd)

    for lame, _ in sorted(names_by_plate.items()):
        for name in sorted(names_by_plate[lame]):
            bound1 = bd[name]['boundaries']['contact_to_penetration']
            bound2 = bd[name]['boundaries']['arg_force_max']
            time = bd[name]['time'][bound1:bound2] - bd[name]['time'][bound1]
            stress = bd[name]['stress'][bound1:bound2]
            plt.plot(time,
                     stress,
                     label=bd[name]['speed'],
                     linestyle='',
                     marker='o',
                     ms=3)
        legend = plt.legend(title=r'$V$ (mm/s) :', prop={'size': 11}, ncol=2)
        plt.setp(legend.get_title(), fontsize=13)
        plt.xlabel(r'$t$ (s)')
        plt.ylabel(r'$\tau_p (Pa)$')
        plt.tight_layout()
        plt.savefig('Penetration_str_tps_' +
                    bd[name]['file_splitted_name'][0] + '.pdf')
        plt.close()