""" File to evaluate the critical velocity and get the resistance the data are the one used in Fig 1 of the main text for I_m = 0""" import os.path, glob from os.path import join import json import pandas as pd import scipy.constants as c import numpy as np import matplotlib.pyplot as pl from scipy.optimize import curve_fit from helper import * from style import * # path to data path_data_repo = "../Fig_1" meas_list = [ { "path": "Exp_Shapiro_steps_f_90_Hz_I_m_0.0.csv", "mod_amp": 0., "color": "#2e2e41", }] result = [] for meas in meas_list: # use here the function returning all the values, do not use the current since it is calulated based on the # vc which will be determined here velocity, _, mu, mu_err, _, f, mod_amp, delta_z, delta_z_err = get_meas_data(meas['path'], path_data_repo=path_data_repo, mod_amp_return=True,meas_dict=meas) # first fit the fig = pl.figure(figsize=(2.5 * 1.61, 2.5)) p_opt, p_cov = curve_fit(conductance_fit, velocity[velocity<=2], delta_z[velocity<=2], p0=[0.3, 1, 0.0]) v = np.arange(0, velocity[-1], 0.001) color = meas["color"] style = get_style(color) pl.errorbar(velocity, delta_z - p_opt[2], yerr=delta_z_err,label=fr'Data', **style) pl.errorbar(v, conductance_fit(v, *p_opt) - p_opt[2], color='firebrick', alpha=1, label = 'Fit') vc = p_opt[0] print(f"critical velocity: {vc:.2f}mm/s") pl.xlabel('Velocity $v$ [mm/s]') pl.ylabel(r'Atom number imbalance $\Delta z$') pl.legend() pl.tight_layout() #pl.show() #pl.savefig("critical_velocity.png") #################### rescale ###################### # rescale to I - µ to get a reasonable value for the resistance R I_c = current(1, v_c=1) # get the critical current from the func keyword parameter # use the above calculated vc to get the current I = current(velocity,v_c=vc) p_opt, p_cov = curve_fit(resistance_fit, I, mu, p0=[0.8e-3, 0.0,200000]) fig2 = pl.figure(figsize=(3.5 * 1.61, 3.5)) pl.errorbar(I/I_c,mu , yerr=mu_err, **get_style(RPTU_COLORS["nacht"]), label = 'Data') pl.errorbar(I/I_c, resistance_fit(I, *p_opt) - p_opt[1], color=RPTU_COLORS["mango"], alpha=1,lw = 2, label = fr'Fit')#: $µ(I) = \sqrt{{I^2 - {I_c:.0f} ^2}} \cdot {p_opt[0]:.4f} $') pl.xlabel('Current $I/I_\mathrm{c}$') pl.ylabel(r'Chemical Potential $\Delta \mu$ [Hz]') pl.legend() print("I_c :",p_opt[2]) print("R :",p_opt[0]) pl.tight_layout() #pl.savefig("critical_velocity_rescaled_resistance.png") pl.show()