boar.agents package

Submodules

boar.agents.Agent module

class boar.agents.Agent.Agent[source]

Bases: object

A base class providing functionality such as plotting, export, that all agents need

Xy_to_dict(X, yexp=[], yfit=[], axis=0, X_dimensions=[])[source]

Convert the X array into a dict containing the measured axis and the (constant) metadata This representation is useful for physical modeling (rate equations, drift-diffusion, etc) while the X notation is more useful for machine learning.

Parameters:
  • X (ndarray) – the experimental dimensions

  • yexp (ndarray of shape(n,)) – the experimental values, if available

  • yfit (ndarray of shape(n,)) – the fitted values, if available

  • axis (int, optional) – the column in X containing the varied parameter, by default 0

  • X_dimensions (list, optional) – names of the X columns (including the measurement axis), by default []

Returns:

key ‘x’ is independent parameter, other keys are metadata

Return type:

dictionary

get_fitval(ps, params)[source]

Get the values for all fitparam objects in params whoes names are mentioned in ps

Parameters:
  • ps (list of string) – list the names of the desired fit parameters

  • params (list of Fitparam()) – Fitparam objects

Returns:

the values of the respective fit parameters

Return type:

list of float

get_param_dict(params)[source]

get standard deviations from parameters if optimization has been done in log scale, convert them into linear scale which will make the upper and lower limit unsymmetric and will return a tuple

Parameters:

params (list of Fitparam()) – list of Fitparam objects

Returns:

list of dict with keys ‘name’(string),’relRange’(float),’val’(float),’std’(float or tuple of float)

Return type:

list of dict

Raises:

ValueError – if optim_type is not ‘linear’ or ‘log’

plot_fit_res(target, params, xaxis_name, xlim=[], ylim=[], kwargs=None)[source]

Compare the targets vs fitting results

Parameters:
  • target (dict) – Dictionary with the target parameters

  • params (list) – list of Fitparam objects with the fitted parameters

  • xaxis_name (str) – name of the x axis

  • xlim (list, optional) – list of 2 elements with the x limits, by default []

  • ylim (list, optional) – list of 2 elements with the y limits, by default []

  • fixed_str (str, optional) – string with the fixed parameters, by default ‘’

  • verbose (bool, optional) – print the results, by default False

  • kwargs (dict, optional) –

    dictionary with the plotting options, by default None

    including:
    savefigbool, optional

    save the figure, by default True

    fignamestr, optional

    name of the figure, by default ‘JV_fit’

    figdirstr, optional

    directory where to save the figure, by default ‘’

    figextstr, optional

    extension of the figure, by default ‘.png’

    figsizetuple, optional

    size of the figure, by default (8,8)

    figdpiint, optional

    dpi of the figure, by default 300

    x_scalingfloat, optional

    scaling factor for the x axis, by default 1

    y_scalingfloat, optional

    scaling factor for the y axis, by default 1

    xscale_typestr, optional

    type of the x axis, by default ‘linear’

    yscale_typestr, optional

    type of the y axis, by default ‘linear’

    norm_databool, optional

    normalize the data, by default False

    delogbool, optional

    de-log the data, by default False

    absxbool, optional

    take the absolute value of the x axis, by default False

    absybool, optional

    take the absolute value of the y axis, by default False

    xaxis_labelstr, optional

    label of the x axis, by default ‘’

    yaxis_labelstr, optional

    label of the y axis, by default ‘’

plot_params(paramslist, fpu=[], kwargs=None)[source]

Plot the fit parameters as a function of the varied parameter

Parameters:
  • paramslist (list) – list of FitParam objects

  • fpu (list, optional) – list to plot on the x axis, by default []

  • kwargs (dict, optional) –

    dictionary with the plotting options, by default None

    including:
    savefigbool, optional

    save the figure, by default True

    fignamestr, optional

    name of the figure, by default ‘JV_fit’

    figdirstr, optional

    directory where to save the figure, by default ‘’

    figextstr, optional

    extension of the figure, by default ‘.png’

    figsizetuple, optional

    size of the figure, by default (8*Np,12)

    figdpiint, optional

    dpi of the figure, by default 300

    nrowsint, optional

    number of rows in the figure, by default 1

    ncolsint, optional

    number of columns in the figure, by default Np

Returns:

tuple containing:

fpu

Return type:

tuple

plot_results(outdict, pdisplay, offset=0, X_dimensions=[], y_dimension='')[source]
to_excel(fn_xlsx, outdict, params)[source]

Export the results to an excel file

Parameters:
  • fn_xlsx (str) – filename of the excel file

  • outdict (dict) – dictionary containing the results see Xy_to_dict

  • params (list of Fitparam()) – list of Fitparam objects

boar.agents.DD_agents module

class boar.agents.DD_agents.Drift_diffusion_agent(path2simu='', SafeModeParallel=True)[source]

Bases: Agent

Agent to run drift diffusion simulations with SIMsalabim to be used with BOAR MultiObjectiveOptimizer

Parameters:

path2simu (str) – Path to the simulation executable

Check_fit_params(vals, names, ParFileDic)[source]
Correct the energy level values from relative positions to absolute positions that are used in SIMsalabim.

Perform the same check as in SIMsalabim to make sure that the energy levels are in the corrected properly.

Parameters:
  • nam (str) – name of the parameter to be checked

  • val (float) – value of the parameter to be checked

  • names (list) – list of the names of the fitting parameters

  • ParFileDic (dict) – dictionary of the parameters in the parameter file

Returns:

ParStrDic – dictionary of the parameters that are to be changed in the parameter file or string

Return type:

dict

Compare_JVs_exp(target, params, FOMs=None, xlim=[], ylim=[], fixed_str='', DD_func=None, verbose=False, kwargs=None)[source]

Compare the simulated JV with the result from the fit

Parameters:
  • target (dict) – Dictionary with the target parameters

  • params (list) – list of Fitparam objects with the fitted parameters

  • FOMs (list, optional) – list of FOMparam objects, by default None

  • xlim (list, optional) – list of 2 elements with the x limits, by default []

  • ylim (list, optional) – list of 2 elements with the y limits, by default []

  • fixed_str (str, optional) – string with the fixed parameters, by default ‘’

  • verbose (bool, optional) – print the results, by default False

  • kwargs (dict, optional) –

    dictionary with the plotting options, by default None

    including:
    savefigbool, optional

    save the figure, by default True

    fignamestr, optional

    name of the figure, by default ‘JV_fit’

    figdirstr, optional

    directory where to save the figure, by default ‘’

    figextstr, optional

    extension of the figure, by default ‘.png’

    figsizetuple, optional

    size of the figure, by default (16,12)

    figdpiint, optional

    dpi of the figure, by default 300

Compare_JVs_simu(target, params, params_true, FOMs, DD_func=None, verbose=False)[source]

Compare the simulated JV with the result from the fit

Parameters:
  • target (dict) – Dictionary with the target parameters

  • params (list) – list of Fitparam objects with the fitted parameters

  • params_true (list) – list of Fitparam objects with the true parameters

  • FOMs (list) – list of FOMparam objects

DriftDiffusion(X, params, X_dimensions=[], max_jobs=3, fixed_str='')[source]

Run the drift diffusion simulations for a given list of parameters

Parameters:
  • X (np.array) – Array of fixed parameters (like Voltages, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

  • max_jobs (int, optional) – maximum number of jobs to run in parallel, by default 3

  • fixed_str (str, optional) – string of fixed parameters to be passed to SIMsalabim, by default ‘’

Returns:

Array of containing the simulation results (Current Density)

Return type:

np.array

DriftDiffusion4fit(X, params, X_dimensions=[], max_jobs=3, fixed_str='', dev_par_fname='', Trap_dist=None, test=True, **kwargs)[source]

Run the drift diffusion simulations for a given list of parametersUse the relative energy level positions, see Check_fit_params for more info. Also, input the custom trap distribution with different models. For now, only the urbach tails and urbach tail plus mid gap traps are implemented. Can also control the CNI, CPI ions densities being equal by using Cions as a parameter name.

Parameters:
  • X (np.array) – Array of fixed parameters (like Voltages, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

  • max_jobs (int, optional) – maximum number of jobs to run in parallel, by default 3

  • fixed_str (str, optional) – string of fixed parameters to be passed to SIMsalabim, by default ‘’

  • dev_par_fname (str, optional) – can be used to update the name of the file containing the device parameters be careful not to provide the dev_par filename in fixed_str, by default ‘’

  • Trap_dist (str, optional) –

    name of the trap model to be used, by default None
    Can be:

    ’conduction_urbach’ : urbach tails below the conduction band ‘calence_urbach’ : urbach tails above the valence band ‘double_urbach’ : urbach tails above the valence band and below the conduction band ‘double_urbach_midgap’ : urbach tails above the valence band and below the conduction band plus mid gap traps None : no trap distribution is used (default)

  • **kwargs (dict, optional) –

    dictionary of optional parameters to be passed to the simulation code, by default {}
    including:
    num_pointsint, optional

    number of points in the trap distribution, by default 20

    ignore_error_codebool, optional

    if True, ignore the error code returned by SIMsalabim, by default True

    take_logbool, optional

    if True, take the log of the absolute value of the current density, by default False

Returns:

Array of containing the simulation results (Current Density)

Return type:

np.array

DriftDiffusion_rela_nrj_Trap_dist(X, params, X_dimensions=[], max_jobs=3, fixed_str='', dev_par_fname='', Trap_dist=None, test=True, **kwargs)[source]

Run the drift diffusion simulations for a given list of parametersUse the relative energy level positions, see Check_fit_params for more info. Also, input the custom trap distribution with different models. For now, only the urbach tails and urbach tail plus mid gap traps are implemented.

Parameters:
  • X (np.array) – Array of fixed parameters (like Voltages, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

  • max_jobs (int, optional) – maximum number of jobs to run in parallel, by default 3

  • fixed_str (str, optional) – string of fixed parameters to be passed to SIMsalabim, by default ‘’

  • dev_par_fname (str, optional) – can be used to update the name of the file containing the device parameters be careful not to provide the dev_par filename in fixed_str, by default ‘’

  • Trap_dist (str, optional) –

    name of the trap model to be used, by default None
    Can be:

    ’conduction_urbach’ : urbach tails below the conduction band ‘calence_urbach’ : urbach tails above the valence band ‘double_urbach’ : urbach tails above the valence band and below the conduction band ‘double_urbach_midgap’ : urbach tails above the valence band and below the conduction band plus mid gap traps None : no trap distribution is used (default)

  • test (bool, optional) – if True, run a test simulation that does not transform the input, by default True

  • **kwargs (dict, optional) –

    dictionary of optional parameters to be passed to the simulation code, by default {}
    including:
    num_pointsint, optional

    number of points in the trap distribution, by default 20

    ignore_error_codebool, optional

    if True, ignore the error code returned by SIMsalabim, by default True

Returns:

Array of containing the simulation results (Current Density)

Return type:

np.array

DriftDiffusion_relative(X, params, X_dimensions=[], max_jobs=3, fixed_str='', dev_par_fname='', **kwargs)[source]

Run the drift diffusion simulations for a given list of parametersUse the relative energy level positions, see Check_fit_params for more info.

Parameters:
  • X (np.array) – Array of fixed parameters (like Voltages, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

  • max_jobs (int, optional) – maximum number of jobs to run in parallel, by default 3

  • fixed_str (str, optional) – string of fixed parameters to be passed to SIMsalabim, by default ‘’

  • dev_par_fname (str, optional) – can be used to update the name of the file containing the device parameters be careful not to provide the dev_par filename in fixed_str, by default ‘’

  • **kwargs (dict, optional) –

    additional arguments to be passed to the DriftDiffusion function, by default {}
    including:
    ignore_error_codebool, optional

    if True, ignore the error code returned by SIMsalabim, by default True

Returns:

Array of containing the simulation results (Current Density)

Return type:

np.array

get_FOM(params_dict, FOMs)[source]

Calculates the FOMs for a given set of parameters

Parameters:
  • params_dict (dict) – Dictionary of the parameters

  • FOMs (list) – list of FOMparam with the FOMs to be calculated

Returns:

Dictionary of the FOMs

Return type:

dict

get_FOMs(X, params, FOMs)[source]

Calculates the FOMs for a given list of parameters and returns a np.array of FOMs for each parameter set

Parameters:
  • X (list) – list of lists of parameters used to calculate FOMs

  • params (list) – list of Fitparam objects

  • FOMs (list) – list of FOMparam with the FOMs to be calculated

Returns:

Array of FOMs

Return type:

np.array

return_FOM(fit_params, FOMs, True_params={})[source]

Print the FOMs for a given set of parameters if True_params is given, also prints the fit and true values

Parameters:
  • fit_params (dict) – dictionary of fit parameters

  • FOMs (list) – list of FOMparam with the FOMs to be calculated

  • True_params (dict, optional) – dictionary of true parameters, by default {}

boar.agents.NonIdealDiode_agents module

class boar.agents.NonIdealDiode_agents.Non_Ideal_Diode_agent(path2simu='')[source]

Bases: object

Agent to run drift diffusion simulations with SIMsalabim to be used with BOAR MultiObjectiveOptimizer

Parameters:

path2simu (str) – Path to the simulation executable

DifferentialIdealityFactor(V, J, T=300)[source]

Calculate the differential ideality factor of a diode from the voltage and current with:

ndiff = 1/(Vt*dV/d(ln(J)))

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J (1-D sequence of floats) – Array containing the currents.

  • T (float, optional) – Absolute temperature , by default 300

Returns:

Array containing the differential ideality factor.

Return type:

1-D sequence of floats

DifferentialResistance(V, J)[source]

Calculate the differential resistance of a diode from the voltage and current with:

Rdiff = dV/dJ

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J (1-D sequence of floats) – Array containing the currents.

Returns:

Array containing the differential resistance.

Return type:

1-D sequence of floats

FitNonIdealDiode(V, J, T=300, JV_type='dark', take_log=True, bounds=([1e-30, 0.8, 1e-08, 0.001], [0.001, 3, 100.0, 100000000.0]), p_start={})[source]

Fit the non ideal diode equation to the data using the least squares method.

see NonIdealDiode_dark and NonIdealDiode_light for more details

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J (1-D sequence of floats) – Array containing the currents.

  • T (float, optional) – Absolute temperature , by default 300

  • JV_type (str, optional) – Type of JV curve to fit. Can be ‘dark’ or ‘light’.

  • take_log (bool, optional) – If True, take the logarithm of the current.

  • bounds (tuple, optional) – Bounds for the fit. The default is ([1e-20, 0.8, 1e-8, 1e-3], [1e-3, 3, 1e2, 1e8])

Returns:

Dictionary containing the fit results. {‘J0’:J0, ‘J0_err’:J0_err, ‘n’:n, ‘n_err’:n_err, ‘Rs’:Rs, ‘Rs_err’:Rs_err, ‘Rsh’:Rsh, ‘Rsh_err’:Rsh_err}

Return type:

dict

NonIdealDiode_dark(V, J0, n, Rs, Rsh, T=300)[source]
Solve non ideal diode equation for dark current

J = J0*[exp(-(V-J*Rs)/(n*Vt*)) - 1] + (V - J*Rs)/Rsh with the method described in: Solid-State Electronics 44 (2000) 1861-1864, see equation (4)-(5)

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J0 (float) – Dark Saturation Current.

  • n (float) – Ideality factor.

  • Rs (float) – Series resistance.

  • Rsh (float) – Shunt resistance.

  • T (float, optional) – Absolute temperature , by default 300

Returns:

Array containing the currents.

Return type:

1-D sequence of floats

NonIdealDiode_dark_log(V, J0, n, Rs, Rsh, T=300)[source]

The logarithmic version of the non ideal diode equation for dark current see NonIdealDiode_dark for more details

note: this is only useful when doing the fits of the dark current-voltage characteristics.

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J0 (float) – Dark Saturation Current.

  • n (float) – Ideality factor.

  • Rs (float) – Series resistance.

  • Rsh (float) – Shunt resistance.

  • T (float, optional) – Absolute temperature , by default 300

Returns:

Array containing the currents.

Return type:

1-D sequence of floats

NonIdealDiode_light(V, J0, n, Rs, Rsh, Jph, T=300)[source]
Solve non ideal diode equation for light current

J = Jph - J0*[exp(-(V-J*Rs)/(n*Vt*)) - 1] - (V - J*Rs)/Rsh with the method described in: Solar Energy Materials & Solar Cells 81 (2004) 269–277 see equation (1)-(2)

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J0 (float) – Dark Saturation Current.

  • n (float) – Ideality factor.

  • Rs (float) – Series resistance.

  • Rsh (float) – Shunt resistance.

  • Jph (float) – Photocurrent.

  • T (float, optional) – Absolute temperature , by default 300

Returns:

Array containing the currents.

Return type:

1-D sequence of floats

NonIdealDiode_light_log(V, J0, n, Rs, Rsh, Jph, T=300)[source]

The logarithmic version of the non ideal diode equation for light current see NonIdealDiode_light for more details

note: this is only useful when doing the fits of the light current-voltage characteristics.

Parameters:
  • V (1-D sequence of floats) – Array containing the voltages.

  • J0 (float) – Dark Saturation Current.

  • n (float) – Ideality factor.

  • Rs (float) – Series resistance.

  • Rsh (float) – Shunt resistance.

  • Jph (float) – Photocurrent.

  • T (float, optional) – Absolute temperature , by default 300

Returns:

Array containing the currents.

Return type:

1-D sequence of floats

get_Jsc(Volt, Curr)[source]

Get the short-circuit current (Jsc) from solar cell JV-curve by interpolating the current at 0 V

Parameters:
  • Volt (1-D sequence of floats) – Array containing the voltages.

  • Curr (1-D sequence of floats) – Array containing the current-densities.

Returns:

Jsc – Short-circuit current value

Return type:

float

get_Voc(Volt, Curr)[source]

Get the Open-circuit voltage (Voc) from solar cell JV-curve by interpolating the Voltage when the current is 0

Parameters:
  • Volt (1-D sequence of floats) – Array containing the voltages.

  • Curr (1-D sequence of floats) – Array containing the current-densities.

Returns:

Voc – Open-circuit voltage value

Return type:

float

boar.agents.TAS_agent module

class boar.agents.TAS_agent.TAS_agent(TAS_model=<function Bimolecular_Trapping_equation>, pump_model=<function square_pump>, pump_params={'A': 9e-06, 'P': 0.0039, 'alpha': 1.0000000000000001e-07, 'background': 0, 'fpu': 10000, 'pulse_width': 2e-05, 't0': 0, 'wvl': 850}, flux_density_model=<function get_flux_density>)[source]

Bases: Agent

Agent to run Transient Absorption Spectroscopy (TAS) simulation based on rate equations to be used with BOAR MultiObjectiveOptimizer

Parameters:
  • TAS_model (function, optional) – TAS model to be used, by default Bimolecular_Trapping_equation To see the available models, check the rate_eq.py file in the dynamic_utils folder

  • pump_model (function, optional) – pump model to be used, by default square_pump To see the available models, check the pump.py file in the dynamic_utils folder

  • pump_params (dict, optional) –

    dictionary of pump parameters, by default {‘P’:0.0039, ‘wvl’:850, ‘fpu’:10000, ‘A’:0.3*0.3*1e-4, ‘alpha’:1e-5*1e-2, ‘pulse_width’:0.2*(1/10000), ‘t0’:0, ‘background’:0}

    including:
    Pfloat

    total CW power of pulse in W

    wvlfloat

    excitation wavelength in nm

    fpufloat

    pump frequency in Hz

    Afloat

    effective pump area in m^-2

    alphafloat

    penetration depth in m

    pulse_widthfloat

    width of the pump pulse in seconds

    t0float, optional

    time shift of the pump pulse, by default 0

    backgroundfloat, optional

    background volume density of generated photons, by default 0

TAS(X, params, X_dimensions=[], take_log=False)[source]

Run the TAS simulations for a given list of parameters

Parameters:
  • X (np.array) – Array of fixed parameters (like time, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

  • take_log (bool, optional) – if True, the simulation results are taken in log10, by default False

Returns:

Array of containing the simulation results

Return type:

np.array

get_pseudo_JV(params, powers, Eg, Nc, T=293)[source]

Calculate the pseudo JV curve from the stationary charge concentration using the TAS model. See: https://doi.org/10.1002/adma.202000080 and https://doi.org/10.1002/solr.202000649

QFLS = Eg - kT * ln(Nc*Nv/n*p)

here we assume Nc = Nv

Parameters:
  • params (list of FitParam objects) – list with the parameters that were fitted

  • powers (1D sequence of floats) – list of the pump powers

  • Eg (float) – bandgap of the material, if Eg is not params then Eg here is used

  • Nc (float) – effective density of states [m^-3] if Nc is not params then Nc here is used

  • T (float, optional) – temperature in K, by default 293

Returns:

Xqfls

Return type:

2D array

init_args_flux_pump_models()[source]

Initialize the arguments for the flux density model, pump model and TAS model For more information, check the pump.py file in the dynamic_utils folder

boar.agents.TrMC_agent module

class boar.agents.TrMC_agent.TrMC_agent(trMC_model=<function Bimolecular_Trapping_equation>, pump_model=<function initial_carrier_density>, pump_params={'background': 0, 'fpu': 1000}, flux_density_model=<function get_flux_density>)[source]

Bases: Agent

Agent to run Transient Phololuminescence simulation based on rate equations to be used with BOAR MultiObjectiveOptimizer

Parameters:
  • trMC_model (function, optional) – trMC model to be used, by default Bimolecular_Trapping_equation To see the available models, check the rate_eq.py file in the dynamic_utils folder

  • pump_model (function, optional) – pump model to be used, by default square_pump To see the available models, check the pump.py file in the dynamic_utils folder

  • pump_params (dict, optional) –

    dictionary of pump parameters, by default {‘P’:0.0039, ‘wvl’:850, ‘fpu’:10000, ‘A’:0.3*0.3*1e-4, ‘alpha’:1e-5*1e-2, ‘pulse_width’:0.2*(1/10000), ‘t0’:0, ‘background’:0}
    including:
    Pfloat

    total CW power of pulse in W

    wvlfloat

    excitation wavelength in nm

    fpufloat

    pump frequency in Hz

    Afloat

    effective pump area in m^-2

    alphafloat

    penetration depth in m

    pulse_widthfloat

    width of the pump pulse in seconds

    t0float, optional

    time shift of the pump pulse, by default 0

    backgroundfloat, optional

    background volume density of generated photons, by default 0

init_args_flux_pump_models()[source]

Initialize the arguments for the flux density model, pump model and trMC model For more information, check the pump.py file in the dynamic_utils folder

trMC(X, params, X_dimensions=[], take_log=False)[source]

Run the trMC simulations for a given list of parameters

Parameters:
  • X (np.array) – Array of fixed parameters (like time, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

Returns:

Array of containing the simulation results

Return type:

np.array

boar.agents.TrPL_agent module

class boar.agents.TrPL_agent.TrPL_agent(trPL_model=<function Bimolecular_Trapping_equation>, pump_model=<function initial_carrier_density>, pump_params={'background': 0, 'fpu': 1000}, flux_density_model=<function get_flux_density>)[source]

Bases: Agent

Agent to run Transient Phololuminescence simulation based on rate equations to be used with BOAR MultiObjectiveOptimizer

Parameters:
  • trPL_model (function, optional) – trPL model to be used, by default Bimolecular_Trapping_equation To see the available models, check the rate_eq.py file in the dynamic_utils folder

  • pump_model (function, optional) – pump model to be used, by default square_pump To see the available models, check the pump.py file in the dynamic_utils folder

  • pump_params (dict, optional) –

    dictionary of pump parameters, by default {‘P’:0.0039, ‘wvl’:850, ‘fpu’:10000, ‘A’:0.3*0.3*1e-4, ‘alpha’:1e-5*1e-2, ‘pulse_width’:0.2*(1/10000), ‘t0’:0, ‘background’:0}
    including:
    Pfloat

    total CW power of pulse in W

    wvlfloat

    excitation wavelength in nm

    fpufloat

    pump frequency in Hz

    Afloat

    effective pump area in m^-2

    alphafloat

    penetration depth in m

    pulse_widthfloat

    width of the pump pulse in seconds

    t0float, optional

    time shift of the pump pulse, by default 0

    backgroundfloat, optional

    background volume density of generated photons, by default 0

init_args_flux_pump_models()[source]

Initialize the arguments for the flux density model, pump model and trPL model For more information, check the pump.py file in the dynamic_utils folder

trPL(X, params, X_dimensions=[], take_log=False)[source]

Run the trPL simulations for a given list of parameters

Parameters:
  • X (np.array) – Array of fixed parameters (like time, light intensities, etc.))

  • params (list) – list of Fitparam objects

  • X_dimensions (list, optional) – name of the fixed parameters in X, by default []

Returns:

Array of containing the simulation results

Return type:

np.array

boar.agents.TranferMatrix_agent module

class boar.agents.TranferMatrix_agent.Transfer_Matrix_agent(layers=None, thicknesses=None, activeLayer=None, lambda_start=None, lambda_stop=None, lambda_step=None, x_step=1, mat_dir='Example_Data/matdata', am15_file='AM15G.csv', unit_th='nm')[source]

Bases: Agent

Agent to run drift diffusion simulations with SIMsalabim to be used with BOAR MultiObjectiveOptimizer

I_mat(n1, n2)[source]

calculate the interface matrix

Parameters:
  • n1 (float) – refractive index of the first material

  • n2 (float) – refractive index of the second material

Returns:

ret – interface matrix

Return type:

array

L_mat(n, d, l)[source]

calculate the propagation matrix

Parameters:
  • n (array) – complex refractive index of the material

  • d (float) – thickness of the material

  • l (float) – wavelength

Returns:

L – propagation matrix

Return type:

array

TM(X, params, output=['Jsc'], is_MOO=False)[source]

Calculate the Jsc, AVT or LUE for a multilayer stack

Parameters:
  • X (np.array) – Array of fixed parameters (not really relevant here)

  • params (list) – list of Fitparam objects

  • output (list, optional) – type of output, can be ‘Jsc’, ‘AVT’ or ‘LUE’, by default [‘Jsc’]

  • is_MOO (bool, optional) – check if the function is called by a MOO algorithm, if True, the output is a dictionary with ‘Jsc’, ‘AVT’ and ‘LUE’ as keys, if not the output is a list with the values in the same order as output, by default False

Returns:

dictionary or list with the values of the requested output

Return type:

dict or list

Raises:
  • ValueError – Wrong indices for the thicknesses

  • ValueError – Wrong indices for the complex refractive index

get_ntotal(matName, lambdas)[source]

get the complex refractive index of a material from a file

Parameters:
  • matName (string) – name of the material in the matdata folder

  • lambdas (list) – list of wavelengths in nm

Returns:

ntotal – list of complex refractive index values

Return type:

list

openFile(fname)[source]

opens files and returns a list split at each new line

Parameters:

fname (string) – path to the file

Returns:

fd – list of lines in the file

Return type:

list

Raises:

ValueError – Target is not a readable file

Module contents