QwaveMPS ======== .. py:module:: QwaveMPS .. autoapi-nested-parse:: QwaveMPS: Package to solve waveguide QED problems using MPS Classes ------- .. autoapisummary:: QwaveMPS.Bins QwaveMPS.InputParams Functions --------- .. autoapisummary:: QwaveMPS.b QwaveMPS.b_dag QwaveMPS.b_dag_l QwaveMPS.b_dag_r QwaveMPS.b_l QwaveMPS.b_pop QwaveMPS.b_pop_l QwaveMPS.b_pop_r QwaveMPS.b_r QwaveMPS.cite QwaveMPS.correlation_2op_1t QwaveMPS.correlation_2op_2t QwaveMPS.correlation_4op_1t QwaveMPS.correlation_4op_2t QwaveMPS.correlation_ss_1t QwaveMPS.correlation_ss_2op QwaveMPS.correlation_ss_4op QwaveMPS.correlations_1t QwaveMPS.correlations_2t QwaveMPS.coupling QwaveMPS.delta_b QwaveMPS.delta_b_dag QwaveMPS.delta_b_dag_l QwaveMPS.delta_b_dag_r QwaveMPS.delta_b_l QwaveMPS.delta_b_r QwaveMPS.e QwaveMPS.entanglement QwaveMPS.exp_decay_envelope QwaveMPS.fock_pulse QwaveMPS.gaussian_envelope QwaveMPS.hamiltonian_1tls QwaveMPS.hamiltonian_1tls_feedback QwaveMPS.hamiltonian_2tls_mar QwaveMPS.hamiltonian_2tls_nmar QwaveMPS.input_state_generator QwaveMPS.loop_integrated_statistics QwaveMPS.normalize_pulse_envelope QwaveMPS.sigmaminus QwaveMPS.sigmaplus QwaveMPS.single_time_expectation QwaveMPS.spectral_intensity QwaveMPS.spectrum_w QwaveMPS.steady_state_index QwaveMPS.t_evol_mar QwaveMPS.t_evol_nmar QwaveMPS.time_dependent_spectrum QwaveMPS.tls_excited QwaveMPS.tls_ground QwaveMPS.tls_pop QwaveMPS.tophat_envelope QwaveMPS.transform_t_tau_to_t1_t2 QwaveMPS.vacuum QwaveMPS.wg_ground Package Contents ---------------- .. py:class:: Bins Bin data used for analysing time-dependent quantities. :param system_states: List of system bins used when calculating single time system observables. :type system_states: list :param output_field_states: Time bins used when calculating single time field observables. :type output_field_states: list :param input_field_states: List of input time bins used for calculating single time field observables incident the system resulting from the defined initial field state. :type input_field_states: list :param correlation_bins: Correlation bins used when computing output field photon correlation functions at two time points. :type correlation_bins: list :param schmidt: Schmidt decomposition system bins usen when calculating entanglement entropy. :type schmidt: list :param loop_field_states: Tau (delay) bins used when calculating delayed field observables. This is the list of field states entering the feedback loop at each time point. :type loop_field_states: list, default: None :param schmidt_tau: Schmidt decomposition tau bins usen when calculating delayed entanglement entropy. :type schmidt_tau: list, default: None .. py:class:: InputParams Input / simulation parameters: :param delta_t: Time step used for time propagation. :type delta_t: float :param tmax: Maximum simulation time. :type tmax: float :param d_sys_total: Array describing the local physical dimensions of the system bins. Each index is associated with the size of a tensor space. :type d_sys_total: np.ndarray :param d_t_total: Array with dimensions for the time bins. Each index is associated with the size of a tensor space. In the case of a two directional light channel will be a list of two values. :type d_t_total: np.ndarray :param bond_max: Maximum MPS bond dimension (chi) to use for truncation. :type bond_max: int :param gamma_l: Coupling (decay) rates to the left and right channels respectively. (may be removed from this class in future versions) :type gamma_l: float :param gamma_r: Coupling (decay) rates to the left and right channels respectively. (may be removed from this class in future versions) :type gamma_r: float :param gamma_l2: Optional second set of coupling rates (e.g. for a second TLS). Default 0 means only one system. (may be removed from this class in future versions) :type gamma_l2: float, default: 0 :param gamma_r2: Optional second set of coupling rates (e.g. for a second TLS). Default 0 means only one system. (may be removed from this class in future versions) :type gamma_r2: float, default: 0 :param tau: Delay time if modelling non-Markovian dynamics. :type tau: float, default: 0 :param phase: Relative delayed phase. (may be removed from this class in future versions) :type phase: float, defulat: 0 :param d_t: Total size of the photonic tensor space. This is the product of the sizes of the indvidual tensor spaces. :type d_t: int .. py:function:: b(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Annihilation operator for observables in the truncated Fock basis. Normalized by :math:`\frac{1}{\sqrt{\Delta t}}`. :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Annihilation operator observable. :rtype: ndarray .. py:function:: b_dag(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Creation operator for observables in the truncated Fock basis. Normalized by :math:`\frac{1}{\sqrt{\Delta t}}`. :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Creation operator observable. :rtype: ndarray .. py:function:: b_dag_l(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Left creation operator for a system with two field channels in the truncated Fock basis. Normalized by :math:`\frac{1}{\sqrt{\Delta t}}`. :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Creation operator observable for left channel. :rtype: ndarray .. py:function:: b_dag_r(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Right creation operator for a system with two field channels, in the truncated Fock basis. Normalized by :math:`\frac{1}{\sqrt{\Delta t}}`. :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Creation operator observable for right channel. :rtype: ndarray .. py:function:: b_l(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Left annihilation operator for a system with two field channels in the truncated Fock basis. Normalized by :math:`\frac{1}{\sqrt{\Delta t}}`. :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Annihilation operator observable for left channel. :rtype: ndarray .. py:function:: b_pop(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Single-channel photonic population operator (normalized by :math:`\frac{1}{\Delta t}`). :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Population operator observable. :rtype: ndarray .. py:function:: b_pop_l(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Left-channel photonic population operator (normalized by :math:`\frac{1}{\Delta t}`). :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Population operator observable for the left channel. :rtype: ndarray .. py:function:: b_pop_r(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Right-channel photonic population operator (normalized by :math:`\frac{1}{\Delta t}`). :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Population operator for the right channel :rtype: ndarray .. py:function:: b_r(params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Right annihilation operator for a system with two field channels, in the truncated Fock basis. Normalized by :math:`\frac{1}{\sqrt{\Delta t}}`. :param params: Object that contains the simulation parameters (time step size and photonic tensor space sizes) :type params: InputParams :returns: **oper** -- Annihlation operator observable for right channel. :rtype: ndarray .. py:function:: cite() Print BibTeX citation for the QwaveMPS package. .. py:function:: correlation_2op_1t(correlation_bins: list[numpy.ndarray], a_op_list: numpy.ndarray | list[numpy.ndarray], b_op_list: numpy.ndarray | list[numpy.ndarray], t: float, params: QwaveMPS.parameters.InputParams) -> tuple[list[numpy.ndarray] | numpy.ndarray, numpy.ndarray] Calculates the two time correlation function :math:`\langle A(t_0)B(t_0+t')\rangle` at a fixed time :math:`t_0` for either single operators :math:`A/B`, or each operator in the lists. Provides list functionality as a single function call with a list of operators is much faster than individual function calls for each operator. :param correlation_bins: List of time bins with the OC in either the initial or final bin in the list. :type correlation_bins: list[ndarray] :param a_op_list: Single operator, A, or a list of operators. :type a_op_list: ndarray/list[ndarray] :param b_op_list: Single operator, B, or a list of operators. :type b_op_list: ndarray/list[ndarray] :param t: Fixed time point for the two time point correlation function calculation. :type t: float :param params: Simulation parameters :type params: InputParams :returns: * **correlations** (*list[np.ndarray]*) -- In the case of single operators a 1D array. In the case of a list of operators returns a list of 1D arrays, each a two time correlation function of fixed t, corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t'], with time increments between points given by the simulation. * **t_list** (*np.ndarray*) -- List of time points for the t' axis. .. py:function:: correlation_2op_2t(correlation_bins: list[numpy.ndarray], a_op_list: numpy.ndarray | list[numpy.ndarray], b_op_list: numpy.ndarray | list[numpy.ndarray], params: QwaveMPS.parameters.InputParams, completion_print_flag: bool = True) -> tuple[list[numpy.ndarray] | numpy.ndarray, numpy.ndarray] Calculates the two time correlation function :math:`\langle A(t)B(t+t')\rangle` for either single operators :math:`A` and :math:`B`, or each :math:`A/B` in a_op_list/b_op_list. Provides list functionality as a single function call with a list of operators is much faster than individual function calls for each operator. :param correlation_bins: List of time bins with the OC in either the initial or final bin in the list. :type correlation_bins: list[ndarray] :param a_op_list: Single operator, A, or a list of operators. :type a_op_list: ndarray/list[ndarray] :param b_op_list: Single operator, B, or a list of operators. :type b_op_list: ndarray/list[ndarray] :param params: Simulation parameters :type params: InputParams :param completion_print_flag: Prints the percent completion of the of the outer loop over t values for the calculation. Note that each loop is shorter, resulting in the percents being weighted more heavily to the start of the calculation. :type completion_print_flag: bool, default: True :returns: * **correlations** (*list[np.ndarray]*) -- In the case of single A and B operators a 2D array. In the case of a list of operators returns a list of 2D arrays, each a two time correlation function corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t,t'], with non-negative t' and time increments between points given by the simulation. * **t_list** (*np.ndarray*) -- List of time points for the t and t' axes. .. py:function:: correlation_4op_1t(correlation_bins: list[numpy.ndarray], a_op_list: numpy.ndarray | list[numpy.ndarray], b_op_list: numpy.ndarray | list[numpy.ndarray], c_op_list: numpy.ndarray | list[numpy.ndarray], d_op_list: numpy.ndarray | list[numpy.ndarray], t: float, params: QwaveMPS.parameters.InputParams) -> tuple[list[numpy.ndarray] | numpy.ndarray, numpy.ndarray] Calculates the two time correlation function :math:`\langle A(t_0)B(t_0+t')C(t_0+t')D(t_0)\rangle` at a fixed time :math:`t_0` for either single operators, or each operator in the lists. Provides list functionality as a single function call with a list of operators is much faster than individual function calls for each operator. :param correlation_bins: List of time bins with the OC in either the initial or final bin in the list. :type correlation_bins: list[ndarray] :param a_op_list: Single operator, A, or a list of operators. :type a_op_list: ndarray/list[ndarray] :param b_op_list: Single operator, B, or a list of operators. :type b_op_list: ndarray/list[ndarray] :param c_op_list: Single operator, C, or a list of operators. :type c_op_list: ndarray/list[ndarray] :param d_op_list: Single operator, D, or a list of operators. :type d_op_list: ndarray/list[ndarray] :param t: Fixed time point for the two time point correlation function calculation. :type t: float :param params: Simulation parameters :type params: InputParams :returns: * **correlations** (*list[np.ndarray]*) -- In the case of single operators a 1D array. In the case of a list of operators returns a list of 1D arrays, each a two time correlation function of fixed t, corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t'], with time increments between points given by the simulation. * **t_list** (*np.ndarray*) -- List of time points for the t' axis. .. py:function:: correlation_4op_2t(correlation_bins: list[numpy.ndarray], a_op_list: numpy.ndarray | list[numpy.ndarray], b_op_list: numpy.ndarray | list[numpy.ndarray], c_op_list: numpy.ndarray | list[numpy.ndarray], d_op_list: numpy.ndarray | list[numpy.ndarray], params: QwaveMPS.parameters.InputParams, completion_print_flag: bool = True) -> tuple[list[numpy.ndarray] | numpy.ndarray, numpy.ndarray] Calculates the two time correlation function :math:`\langle A(t)B(t+t')C(t+t')D(t)\rangle` for either single operators :math:`A/B/C/D`, or each operator in the four lists. Provides list functionality as a single function call with a list of operators is much faster than individual function calls for each operator. :param correlation_bins: List of time bins with the OC in either the initial or final bin in the list. :type correlation_bins: list[ndarray] :param a_op_list: Single operator, A, or a list of operators. :type a_op_list: ndarray/list[ndarray] :param b_op_list: Single operator, B, or a list of operators. :type b_op_list: ndarray/list[ndarray] :param c_op_list: Single operator, C, or a list of operators. :type c_op_list: ndarray/list[ndarray] :param d_op_list: Single operator, D, or a list of operators. :type d_op_list: ndarray/list[ndarray] :param params: Simulation parameters :type params: InputParams :param completion_print_flag: Prints the percent completion of the of the outer loop over t values for the calculation. Note that each loop is shorter, resulting in the percents being weighted more heavily to the start of the calculation. :type completion_print_flag: bool, default: True :returns: * **correlations** (*list[np.ndarray]*) -- In the case of single operators a 2D array. In the case of a list of operators returns a list of 2D arrays, each a two time correlation function corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t,t'], with non-negative t' and time increments between points given by the simulation. * **t_list** (*np.ndarray*) -- List of time points for the t and t' axes. .. py:function:: correlation_ss_1t(correlation_bins: list[numpy.ndarray], output_field_states: list[numpy.ndarray], ops_same_time: list[numpy.ndarray], ops_two_time: list[numpy.ndarray], params: QwaveMPS.parameters.InputParams, tol: float = 1e-05, window: int = 10, t_steady: float = None) -> tuple[list[numpy.ndarray], numpy.ndarray, float] Efficient steady-state correlation calculation. This computes time differences starting from a convergence index (steady-state index). It returns a list of the 1D correlation arrays corresponding to the operator list, a list of tau points, and the initial t point at which steady state is considered. :param correlation_bins: Correlation bins of the outputfield states used to determine multi-timepoint correlation functions of the output field. :type correlation_bins: list[np.ndarray] :param output_field_states: OC normalized output field states. :type output_field_states: list[np.ndarray] :param ops_same_time: List of operators of which correlation functions should be calculated in the case that tau=0 (same time). These should exist in a single time-bin tensor space. :type ops_same_time: [ndarray] :param ops_two_time: List of operators of which correlation functions should be calculated in the case that tau > 0. These should be ordered in a corresponding order to ops_same_time and should exist in a tensor space that is the outer product of two time bin tensor spaces, with the right space corresponding to the greater time. :type ops_two_time: [ndarray] :param params: Simulation parameters :type params: InputParams :param window: Number of recent points to analyze when determining the steady state time. :type window: int, default: 10 :param tol: Maximum deviation allowed in the final window for the steady state time. :type tol: float, default: 1e-5 :param t_steady: User defined steady state time. If not provided, steady state is determined by convergence of the same time expectation values of the observables. :type t_steady: float, default: None :returns: * **correlations** (*list[ndarray]*) -- A list of 1D arrays, each a two time correlation function of fixed t at steady state, corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t'], with time increments between points given by the simulation. * **t_list** (*ndarray*) -- List of time points for the t' axis. * **t_ss** (*float*) -- Time that steady state is reached. .. py:function:: correlation_ss_2op(correlation_bins: list[numpy.ndarray], output_field_states: list[numpy.ndarray], a_op_list: numpy.ndarray | list[numpy.ndarray], b_op_list: numpy.ndarray | list[numpy.ndarray], params: QwaveMPS.parameters.InputParams, tol: float = 1e-05, window: int = 20, t_steady: float = None) -> tuple[list[numpy.ndarray] | numpy.ndarray, numpy.ndarray, float] Calculates the two time correlation function :math:`\langle A(t_{ss})B(t_{ss}+t')\rangle` at a steady state value of t for either single operators, or each operator in the lists. Provides list functionality as a single function call with a list of operators is much faster than individual function calls for each operator. In that case calculates the steady states correlation from the greatest steady state time of the operators. :param correlation_bins: List of time bins with the OC in either the initial or final bin in the list. :type correlation_bins: list[ndarray] :param a_op_list: Single operator, A, or a list of operators. :type a_op_list: ndarray/list[ndarray] :param b_op_list: Single operator, B, or a list of operators. :type b_op_list: ndarray/list[ndarray] :param params: Simulation parameters :type params: InputParams :param tol: The tolerance for which convergence of the operators is determined. Used to find the steady state time. :type tol: float, default: 1e-5 :param window: Number of recent points to analyze when determining the steady state time. :type window: int, default: 20 :param t_steady: User defined steady state time. If not provided, steady state is determined by convergence of the same time expectation values of the observables. :type t_steady: float, default: None :returns: * **correlations** (*list[ndarray]*) -- In the case of single operators a 1D array. In the case of a list of operators returns a list of 1D arrays, each a two time correlation function of fixed t at steady state, corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t'], with time increments between points given by the simulation. * **t_list** (*ndarray*) -- List of time points for the t' axis. * **t_ss** (*float*) -- Time that steady state is reached. .. py:function:: correlation_ss_4op(correlation_bins: list[numpy.ndarray], output_field_states: list[numpy.ndarray], a_op_list: numpy.ndarray | list[numpy.ndarray], b_op_list: numpy.ndarray | list[numpy.ndarray], c_op_list: numpy.ndarray | list[numpy.ndarray], d_op_list: numpy.ndarray | list[numpy.ndarray], params: QwaveMPS.parameters.InputParams, tol: float = 1e-05, window: int = 20, t_steady: float = None) -> tuple[list[numpy.ndarray] | numpy.ndarray, numpy.ndarray, float] Calculates the two time correlation function :math:`\langle A(t_{ss})B(t_{ss}+t')C(t_{ss}+t')D(t_{ss})\rangle` at a steady state value of t for either single operators, or each operator in the lists. Provides list functionality as a single function call with a list of operators is much faster than individual function calls for each operator. In that case calculates the steady states correlation from the greatest steady state time of the operators. :param correlation_bins: List of time bins with the OC in either the initial or final bin in the list. :type correlation_bins: list[ndarray] :param a_op_list: Single operator, A, or a list of operators. :type a_op_list: ndarray/list[ndarray] :param b_op_list: Single operator, B, or a list of operators. :type b_op_list: ndarray/list[ndarray] :param c_op_list: Single operator, C, or a list of operators. :type c_op_list: ndarray/list[ndarray] :param d_op_list: Single operator, D, or a list of operators. :type d_op_list: ndarray/list[ndarray] :param params: Simulation parameters :type params: InputParams :param tol: The tolerance for which convergence of the operators is determined. Used to find the steady state time. :type tol: float, default: 1e-5 :param window: Number of recent points to analyze when determining the steady state time. :type window: int, default: 20 :param t_steady: User defined steady state time. If not provided, steady state is determined by convergence of the same time expectation values of the observables. :type t_steady: float, default: None :returns: * **correlations** (*list[ndarray]*) -- In the case of single operators a 1D array. In the case of a list of operators returns a list of 1D arrays, each a two time correlation function of fixed t at steady state, corresponding by index to the operators in the two operator lists. The two time correlation function is stored as f[t'], with time increments between points given by the simulation. * **t_list** (*ndarray*) -- List of time points for the t' axis. * **t_ss** (*float*) -- Time that steady state is reached. .. py:function:: correlations_1t(correlation_bins: list[numpy.ndarray], ops_same_time: list[numpy.ndarray], ops_two_time: list[numpy.ndarray], t: float, params: QwaveMPS.parameters.InputParams) -> tuple[list[numpy.ndarray], numpy.ndarray] General two-time correlation calculator along a single axis. Take in list of time ordered normalized (with OC) time bins at position of relevance. Calculate a list of arbitrary two time point correlation functions at t and t+tau for nonnegative t'. :param time_bin_list: List of time bins with the OC in either the initial or final bin in the list. :type time_bin_list: list[ndarray] :param ops_same_time: List of operators of which correlation functions should be calculated in the case that t'=0 (same time). These should exist in a single time-bin tensor space. :type ops_same_time: list[ndarray] :param ops_two_time: List of operators of which correlation functions should be calculated in the case that t' > 0. These should be ordered in a corresponding order to ops_same_time and should exist in a tensor space that is the outer product of two time bin tensor spaces, with the right space corresponding to the greater time. :type ops_two_time: list[ndarray] :param t: Time point for fixed t at which to take the two time point correlation. :type t: float :param params: Simulation parameters :type params: InputParams :returns: * **correlations** (*ndarray[ndarray[complex]]*) -- List of 1D arrays, each a two time correlation function corresponding by index to the operators in ops_same_time and ops_two_time. The two time correlation function is stored as f[t,t'], with non-negative t' and time increments between points given by the simulation. * **ts_correlation** (*ndarray[float]*) -- List of time points for the t' axis at which the two time point correlation functions are taken. .. py:function:: correlations_2t(correlation_bins: list[numpy.ndarray], ops_same_time: list[numpy.ndarray], ops_two_time: list[numpy.ndarray], params: QwaveMPS.parameters.InputParams, completion_print_flag: bool = False) -> tuple[list[numpy.ndarray], numpy.ndarray] General two-time correlation calculator. Take in list of time ordered normalized (with OC) time bins at position of relevance. Calculate a list of arbitrary two time point correlation functions at t and t+t' for nonnegative t'. :param time_bin_list: List of time bins with the OC in either the initial or final bin in the list. :type time_bin_list: [ndarray] :param ops_same_time: List of operators of which correlation functions should be calculated in the case that t'=0 (same time). These should exist in a single time-bin tensor space. :type ops_same_time: [ndarray] :param ops_two_time: List of operators of which correlation functions should be calculated in the case that t' > 0. These should be ordered in a corresponding order to ops_same_time and should exist in a tensor space that is the outer product of two time bin tensor spaces, with the right space corresponding to the greater time. :type ops_two_time: [ndarray] :param params: Simulation parameters :type params: InputParams :param completion_print_flag: Flag to print completion loop number percent of the calculation (note this is not the percent completion, and later loops complete faster than earlier ones). :type completion_print_flag: bool, default=True :returns: * **result** (*list[np.ndarray]*) -- List of 2D arrays, each a two time correlation function corresponding by index to the operators in ops_same_time and ops_two_time. The two time correlation function is stored as f[t,t'], with non-negative t' and time increments between points given by the simulation. * **correaltion_times** (*np.ndarray[float]*) -- List of time points for the t and t' axes for the calculated correlation functions. .. py:function:: coupling(coupl: str = 'symmetrical', gamma: float = 1, gamma_r=None, gamma_l=None) -> tuple[float, float] Return (gamma_l, gamma_r) given a coupling specification. It can be 'symmetrical', 'chiral_r', 'chiral_l', 'other' For 'other', provide gamma_l and gamma_r explicitly. :param coupl: Coupling option. :type coupl: {'symmetrical', 'chiral_r', 'chiral_l', 'other'}, default: 'symmetrical' :param gamma: Total coupling. Code in units of coupling, hence, the default is 1. :type gamma: float, default:1 :param gamma_r: Left coupling. If coupl = 'other' define explicitly. :type gamma_r: None/float, default: None :param gamma_l: Right coupling. If coupl = 'other' define explicitly. :type gamma_l: None/float, default: None :returns: **gamma_l,gamma_r** -- Values of the left and right coupling :rtype: tuple[float,float] .. py:function:: delta_b(delta_t: float, d_t: int = 2) -> numpy.ndarray Time bin noise annihilation operator scaled by :math:`\sqrt{\Delta t}` in the truncated Fock basis. :param delta_t: Time step for system evolution. :type delta_t: float :param d_t: Size of the truncated field Hilbert space :type d_t: int, default: 2 :returns: **oper** -- Time bin noise creation operator. :rtype: ndarray .. py:function:: delta_b_dag(delta_t: float, d_t: int = 2) -> numpy.ndarray Time bin noise creation operator scaled by :math:`\sqrt{\Delta t}` in the truncated Fock basis. :param delta_t: Time step for system evolution. :type delta_t: float :param d_t: Size of the truncated field Hilbert space :type d_t: int, default: 2 :returns: **oper** -- Time bin noise creation operator. :rtype: ndarray .. py:function:: delta_b_dag_l(delta_t: float, d_t_total: numpy.ndarray) -> numpy.ndarray Left time bin noise creation operator for a system with two field channels, scaled by :math:`\sqrt{\Delta t}` in the truncated Fock basis. :param delta_t: Time step for system evolution. :type delta_t: float :param d_t_total: List of sizes of the photonic Hilbert spaces (left and right channels). :type d_t_total: ndarray :returns: **oper** -- Left time bin noise creation operator. :rtype: ndarray .. py:function:: delta_b_dag_r(delta_t: float, d_t_total: numpy.ndarray) -> numpy.ndarray Right time bin noise creation operator for a system with two field channels, scaled by :math:`\sqrt{\Delta t}` in the truncated Fock basis. :param delta_t: Time step for system evolution. :type delta_t: float :param d_t_total: List of sizes of the photonic Hilbert spaces (left and right channels). :type d_t_total: ndarray :returns: **oper** -- Right time bin noise creation operator. :rtype: ndarray .. py:function:: delta_b_l(delta_t: float, d_t_total: numpy.ndarray) -> numpy.ndarray Left time bin noise annihilation operator for a system with two field channels, scaled by :math:`\sqrt{\Delta t}` in the truncated Fock basis. :param delta_t: Time step for system evolution. :type delta_t: float :param d_t_total: List of sizes of the photonic Hilbert spaces (left and right channels). :type d_t_total: ndarray :returns: **oper** -- Left time bin noise annihilation operator. :rtype: ndarray .. py:function:: delta_b_r(delta_t: float, d_t_total: numpy.ndarray) -> numpy.ndarray Right time bin noise annihilation operator for a system with two field channels, scaled by :math:`\sqrt{\Delta t}` in the truncated Fock basis. :param delta_t: Time step for system evolution. :type delta_t: float :param d_t_total: List of sizes of the photonic Hilbert spaces. :type d_t_total: ndarray :returns: **oper** -- Right time bin noise annihilation operator (left and right channels). :rtype: ndarray .. py:function:: e(d_sys: int = 2) -> numpy.ndarray Projector onto the excited TLS state, :math:`|e\rangle\langle e|`. :param d_sys: Size of the Hilbert space of the matter system. For a two level system have d_sys=2. :type d_sys: int, default: 2 :returns: **oper** -- The excited state projector :rtype: ndarray .. py:function:: entanglement(sch: list[numpy.ndarray]) -> list[float] Compute von Neumann entanglement entropy across a list of Schmidt coefficient arrays. :param sch: List of Schmidt coefficient arrays (s) for each bipartition. :type sch: list[np.ndarray] :returns: **time_dependent_entanglement** -- Entanglement entropies computed as :math:`-\sum(p\log_2 p)` where :math:`p = s^2`. :rtype: list[float] .. py:function:: exp_decay_envelope(pulse_time: float, params: QwaveMPS.parameters.InputParams, decay_rate: float, decay_center: float = 0) -> numpy.ndarray Create a exponential decay pulse envelope (unnormalized) given by the time length of the pulse and the decay rate and decay center parameters. :param pulse_time: Duration time of the pulse (units of inverse coupling). :type pulse_time: float :param params: Class containing the input parameters :type params: InputParams :param decay_rate: Decay rate of the exponential. :type decay_rate: float :param decay_center: Time center/offset of the exponential decay function. :type decay_center: float :returns: **pulse_envelope** -- List of amplitude values of the pulse envelope. :rtype: list[float] .. py:function:: fock_pulse(pulse_env: list[float], pulse_time: float, photon_num: int, params: QwaveMPS.parameters.InputParams, direction: str = 'R', bond0: int = 1) -> list[numpy.ndarray] Creates an Fock pulse input field state with a normalized pulse envelope :param pulse_env: Time dependent pulse envelope for the incident pulse (can be unnormalized). If None, uses a tophat pulse for the duration of the pulse_time. :type pulse_env: list[float] :param pulse_time: Time length of the pulse (units of inverse coupling). If the pulse envelope is of greater length it will be truncated from the tail. :type pulse_time: float :param photon_num: Incident photon number. :type photon_num: int :param params: Class containing the input parameters :type params: InputParams :param direction: Flag to dictate the direction of the propagating pulse. Ignored if only a single photonic channel (chiral) is present. :type direction: {'L','R'}, default: 'R' :param bond0: Default bond dimension of bins. :type bond0: int, default: 1 :returns: **fock_pulse** -- A list of the incident time bins of the Fock pulse, with the first bin in index 0. Further uncorrelated fields can be appended to the end of the list. :rtype: list[ndarray] .. rubric:: Examples .. py:function:: gaussian_envelope(pulse_time: float, params: QwaveMPS.parameters.InputParams, gaussian_width: float, gaussian_center: float) -> numpy.ndarray Create a gaussian pulse envelope given by the time length of the pulse and the mean and standard deviation parameters. :param pulse_time: Duration time of the pulse (units of inverse coupling). :type pulse_time: float :param params: Class containing the input parameters :type params: InputParams :param gaussian_width: Variance of the gaussian (units of inverse coupling). :type gaussian_width: float :param gaussian_center: Mean of the gaussian (units of inverse coupling). :type gaussian_center: float :returns: **pulse_envelope** -- List of amplitude values of the pulse envelope. :rtype: np.ndarray[float] .. py:function:: hamiltonian_1tls(params: QwaveMPS.parameters.InputParams, omega: float | QwaveMPS.operators.np.ndarray = 0, delta: float = 0) -> Hamiltonian Hamiltonian for 1 two-level system coupled to an infinite waveguide. The returned Hamiltonian includes: - A classical pump term (omega) acting on the TLS, :math:`\Omega(\sigma^+ + \sigma^-)` - A detuning term for the TLS, :math:`\delta |e\rangle\langle e|`. - Interaction terms between the TLS and left/right photonic modes. :param params: Class containing the input parameters. :type params: InputParams :param omega: Classical pump amplitude. If a float is provided (CW pump) a single Hamiltonian ndarray is returned. If a 1D np.ndarray is given (pulsed light), the function returns a callable hm_total(t_k) that yields the Hamiltonian at discrete time index t_k using omega[t_k]. :type omega: float/np.ndarray, default: 0 :param delta: Detuning between the pump and two-level system transition frequency. :type delta: float, optional :returns: **Hamiltonian** -- Hamiltonian as a numpy.ndarray (time-independent drive) or a callable that accepts a time index and returns the Hamiltonian (time-dependent drive). :rtype: np.ndarray | Callable[[int], np.ndarray] .. py:function:: hamiltonian_1tls_feedback(params: QwaveMPS.parameters.InputParams, omega: float | QwaveMPS.operators.np.ndarray = 0, delta: float = 0) -> Hamiltonian Hamiltonian for 1 two-level system in a semi-infinite waveguide with a side mirror (with feedback). The returned Hamiltonian includes: - A classical pump term (omega) acting on the TLS, :math:`\Omega(\sigma^+ + \sigma^-)` - A detuning term for the TLS, :math:`\delta |e\rangle\langle e|`. - Interaction terms between the TLS and a single photonic mode (on the present and feedback bins). :param params: Class containing the input parameters. (It must include the phase) :type params: InputParams :param omega: Classical pump amplitude. If a float is provided (CW pump) a single Hamiltonian ndarray is returned. If a 1D np.ndarray is given (pulsed light), the function returns a callable hm_total(t_k) that yields the Hamiltonian at discrete time index t_k using omega[t_k]. :type omega: float or np.ndarray, default: 0 :param delta: Detuning between the pump and TLS transition frequency. :type delta: float, default: 0 :returns: **Hamiltonian** -- Hamiltonian as a numpy.ndarray (time-independent drive) or a callable that accepts a time index and returns the Hamiltonian (time-dependent drive). :rtype: np.ndarray | Callable[[int], np.ndarray] .. py:function:: hamiltonian_2tls_mar(params: QwaveMPS.parameters.InputParams, omega1: float | QwaveMPS.operators.np.ndarray = 0, delta1: float = 0, omega2: float | QwaveMPS.operators.np.ndarray = 0, delta2: float = 0) -> Hamiltonian Hamiltonian for 2 two-level systems in an infinite waveguide in the Markovian regime. The returned Hamiltonian includes: - Classical pump terms (omega1/omega2) acting on TLS1/TLS2, :math:`\Omega_i(\sigma_i^+ + \sigma_i^-)` - A detuning term delta1/delta2 for TLS1/TLS2, :math:`\delta_i |e\rangle_i\langle e|_i`. - Interaction terms between the TLSs and left/right photonic modes. :param params: Class containing the input parameters. :type params: InputParams :param omega1: Drive for two-level system 1 (can be a float for CW pumps or a time-dependent array for pulsed light). :type omega1: float/np.ndarray, default: 0 :param delta1: Detuning for two-level system 1. :type delta1: float, default: 0 :param omega2: Drive for two-level system 2 (can be a float for CW pumps or a time-dependent array for pulsed light). :type omega2: float/np.ndarray, default: 0 :param delta2: Detuning for two-level system 1. :type delta2: float, default: 0 :returns: **Hamiltonian** -- Hamiltonian as a numpy.ndarray (time-independent drive) or a callable that accepts a time index and returns the Hamiltonian (time-dependent drive). :rtype: np.ndarray | Callable[[int], np.ndarray] .. py:function:: hamiltonian_2tls_nmar(params: QwaveMPS.parameters.InputParams, omega1: float | QwaveMPS.operators.np.ndarray = 0, delta1: float = 0, omega2: float | QwaveMPS.operators.np.ndarray = 0, delta2: float = 0) -> Hamiltonian Hamiltonian for 2 two-level systems in an infinite waveguide in the non-Markovian regime (feedback). The returned Hamiltonian includes: - Classical pump terms (omega1/omega2) acting on TLS1/TLS2, :math:`\Omega_i(\sigma_i^+ + \sigma_i^-)` - A detuning term delta1/delta2 for TLS1/TLS2, :math:`\delta_i |e\rangle_i\langle e|_i`. - Interaction terms between the two-level systems and left/right photonic modes (on the present and feedback bins). :param params: Class containing the input parameters. :type params: InputParams :param omega1: Drive for two-level system 1 (can be a float for CW pumps or a time-dependent array for pulsed light). :type omega1: float/np.ndarray, default: 0 :param delta1: Detuning for two-level system 1. :type delta1: float, default: 0 :param omega2: Drive for two-level system 2 (can be a float for CW pumps or a time-dependent array for pulsed light). :type omega2: float/np.ndarray, default: 0 :param delta2: Detuning for two-level system 1. :type delta2: float, default: 0 :returns: **Hamiltonian** -- Hamiltonian as a numpy.ndarray (time-independent drive) or a callable that accepts a time index and returns the Hamiltonian (time-dependent drive). :rtype: np.ndarray | Callable[[int], np.ndarray] .. py:function:: input_state_generator(d_t_total: list[int], input_bins: list[numpy.ndarray] = None, bond0: int = 1, default_state=None) -> collections.abc.Iterator[numpy.ndarray] Creates an iterator (generator) for the input field states of the waveguide. :param d_t_total: List of sizes of the photonic Hilbert spaces. :type d_t_total: list[int] :param input_bins: List of time bins describing the input field state. :type input_bins: list[np.ndarray], default: None :param bond0: Size of the initial bond dimension. :type bond0: int, default: 1 :param default_state: Default time bin state yielded as an input state after all input_bins are exhusted. If None then vacuum states are yielded. :type default_state: ndarray, default: None :returns: **gen** -- A generator for the input field time bins. :rtype: Generator .. py:function:: loop_integrated_statistics(time_dependent_func: numpy.ndarray[complex], params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Calculates the time dependent integral of the function over all points in the feedback loop at each time point of the system evolution. This is a moving windowed integral over the function, with the window size of length tau (the feedback time) For t numpy.ndarray Normalizes a given pulse envelope so that the integral of the square magnitude is 1. :param delta_t: Time step size for the simulation. :type delta_t: float :param pulse_env: Time dependent pulse envelope that is being normalized. :type pulse_env: np.ndarray[float] :returns: **pulse_env** -- The normalized time dependent pulse envelope. :rtype: np.ndarray[float] .. py:function:: sigmaminus() -> numpy.ndarray Lowering operator for the Pauli spins, :math:`|g\rangle\langle e|`. :returns: **sigma_minus** -- The Pauli spin lowering operator. :rtype: ndarray .. py:function:: sigmaplus() -> numpy.ndarray Raising operator for the Pauli spins, :math:`|e\rangle \langle g|`. :returns: **sigma_plus** -- The Pauli spin raising operator. :rtype: ndarray .. py:function:: single_time_expectation(normalized_bins: list[numpy.ndarray], ops_list: numpy.ndarray | list[numpy.ndarray]) -> numpy.ndarray Compute expectation values of a list of operators on a list of OC normalized bins. :param normalized_bins: List of OC normalized bins in order of time to have localized expectation values taken. :type normalized_bins: list[ndarray] :param ops_list: List of operators or a single operator to take expectation values. Each operator must be compatible with the bin physical space. :type ops_list: ndarray/list[ndarray] :returns: **expectation_values** -- In the case of a single operator returns a list of expectation values for each time point. For a list of operators returns a 2D array shaped (len(ops_list), len(normalized_bins)) with expectation values for each operator at each time. :rtype: np.ndarray[complex] | np.ndarray[np.ndarray[complex]] .. py:function:: spectral_intensity(correlation_matrix: numpy.ndarray, input_params: QwaveMPS.parameters.InputParams, padding: int = 0, hanning_filter: bool = False, taper_length: int = 16) -> tuple[numpy.ndarray, numpy.ndarray] Calculate the time dependent spectral intensity from a given two time correlation function. Given a correlation function of the form :math:`\langle A(t)B(t+\tau)\rangle` this computes the function .. math:: I(\omega, t) = \int_0^\infty d\tau \langle A(t)B(t+\tau) \rangle e^{i\Delta_{\omega p}\tau} :param correlation_matrix: Computed two time correlation matrix used for the calculation of the spectral intensity. :type correlation_matrix: np.ndarray :param input_params: Input parameters of the simulation :type input_params: InputParams :param padding: Number of 0's added to the Fourier transform as padding for smoother results. :type padding: int, default=0 :param hanning_filter: Determines whether or not a Hanning filter is used to smooth the decay at the end of the function for a smoother result. :type hanning_filter: bool, default=False :param taper_length: Determines the number of time points from the end of the data on which the Hanning filter is applied. Only relevant if hanning_filter is True. :type taper_length: int, default=16 :returns: * **spectral_intensity** (*np.ndarray*) -- The computed time dependent spectral intensity of the given correlation function. * **w_list** (*np.ndarray*) -- List of frequencies associated with the calculated spectral intensity. .. py:function:: spectrum_w(delta_t: float, g1_list: numpy.ndarray) -> tuple[numpy.ndarray, numpy.ndarray] Compute the (discrete) spectrum in the long-time limit via Fourier transform of the two-time first-order correlation (steady-state solution). :param delta_t: Time step used in the simulation; used to set frequency sampling. :type delta_t: float :param g1_list: Steady-state first order correlation. :type g1_list: np.ndarray :returns: * **s_w** (*np.ndarray*) -- Spectrum in the long-time limit (steady state solution) * **wlist** (*np.ndarray*) -- Corresponding frequency list. .. py:function:: steady_state_index(output_field_states: list[numpy.ndarray], tol: float = 1e-05, window: int = 10) -> numpy.ndarray[int] Steady-state index helper function to find the time step when the steady state is reached in the single time dynamics of each operator. :param output_field_states: List of OC normalized output_field_states/bins. :type output_field_states: list[np.ndarray] :param tol: Maximum deviation allowed in the final window :type tol: float, default: 1e-5 :param window: Number of recent points to analyze :type window: int, default: 10 :returns: **steady_state_index** -- The index of the start of the steady window for the output field. :rtype: int .. py:function:: t_evol_mar(ham: QwaveMPS.hamiltonians.Hamiltonian, i_s0: QwaveMPS.operators.np.ndarray, i_n0: QwaveMPS.operators.np.ndarray, params: QwaveMPS.operators.InputParams) -> tuple[list[QwaveMPS.operators.np.ndarray], list[QwaveMPS.operators.np.ndarray]] Time evolution of the system without delay times (Markovian regime) :param ham: Either a fixed evolution operator/tensor or a callable returning the evolution operator for time-step k: ham(k). :type ham: ndarray or callable :param i_s0: Initial system bin (tensor). :type i_s0: ndarray :param i_n0: Initial field bin. Seed for the input time-bin generator. :type i_n0: ndarray :param params: Class containing the input parameters (contains delta_t, tmax, bond, d_t_total, d_sys_total). :type params: InputParams :returns: **results** -- containing: - sys_b: list of system bins - time_b: list of time bins - cor_b: list of tensors used for correlations - schmidt: list of Schmidt coefficient arrays (for entanglement calculation) :rtype: Bins (from parameters.py) .. py:function:: t_evol_nmar(ham: QwaveMPS.hamiltonians.Hamiltonian, i_s0: QwaveMPS.operators.np.ndarray, i_n0: QwaveMPS.operators.np.ndarray, params: QwaveMPS.operators.InputParams) -> tuple[list[QwaveMPS.operators.np.ndarray], list[QwaveMPS.operators.np.ndarray], list[QwaveMPS.operators.np.ndarray]] Time evolution of the system with finite delays/feedback (non-Markovian regime). Requires tau to be at least delta_t. :param ham: Either a fixed evolution operator/tensor or a callable returning the evolution operator for time-step k: ham(k). i_s0 : ndarray Initial system bin (tensor). i_n0: ndarray Initial field bin. Seed for the input time-bin generator. params : InputParams Class containing the input parameters (contains delta_t, tmax, bond, d_t_total, d_sys_total, tau.). :type ham: ndarray/callable :returns: **Bins** -- containing: - sys_b: list of system bins - time_b: list of time bins - tau_b: list of feedback bins - cor_b: list of tensors used for correlations - schmidt, schmidt_tau: lists of Schmidt coefficient arrays :rtype: Dataclass (from parameters.py) .. py:function:: time_dependent_spectrum(correlation_matrix: numpy.ndarray, input_params: QwaveMPS.parameters.InputParams, w_list: numpy.ndarray = None, padding: int = 0) -> tuple[numpy.ndarray, numpy.ndarray] Calculate the time dependent spectra from a given two time correlation function. Given a correlation function of the form :math:`\langle A(t)B(t+\tau)\rangle` this computes the function .. math:: S(\omega, t) = \int_0^t dt' \int_0^{t-t'} d\tau \langle A(t)B(t+\tau) \rangle e^{i\Delta_{\omega p}\tau} :param correlation_matrix: Computed two time correlation matrix used for the calculation of the spectral intensity. :type correlation_matrix: np.ndarray :param input_params: Input parameters of the simulation :type input_params: InputParams :param w_list: Frequency points at which the time dependent spectrum is calculated. If None, generates the frequency list using np.fft.fftfreq() on the length of the correlation_matrix. :type w_list: np.ndarray, default=None :param padding: Padding added to the frequency domain. :type padding: int, default: 0 :returns: * **spectrum** (*np.ndarray*) -- The computed time dependent spectrum of the given correlation function. * **w_list** (*np.ndarray*) -- List of frequencies associated with the calculated time dependent spectrum. .. py:function:: tls_excited(bond0: int = 1) -> numpy.ndarray Two level system excited state tensor. :param bond0: Initial size of the bond dimension. :type bond0: int, default: 1 :returns: **state** -- Excited state of the two level system. :rtype: ndarray .. py:function:: tls_ground(bond0: int = 1) -> numpy.ndarray Two level system ground state tensor. :param bond0: Initial size of the bond dimension. :type bond0: int, default: 1 :returns: **state** -- Ground state of the two level system. :rtype: ndarray .. py:function:: tls_pop(d_sys: int = 2) -> numpy.ndarray Single TLS population operator, :math:`\sigma^+ \sigma^-`. :param d_sys: Size of the Hilbert space of the matter system. For a two level system have d_sys=2. :type d_sys: int, default: 2 :returns: **pop_operator** -- Population operator for a TLS :rtype: ndarray .. py:function:: tophat_envelope(pulse_time: float, params: QwaveMPS.parameters.InputParams) -> numpy.ndarray Create an unnormalized top hat pulse envelope given by the time length of the pulse. :param pulse_time: Duration time of the pulse (units of inverse coupling). :type pulse_time: float :param params: Class containing the input parameters. :type params: InputParams :returns: **pulse_envelope** -- List of amplitude values of the pulse envelope. :rtype: list[float] .. py:function:: transform_t_tau_to_t1_t2(positive_tau_results: numpy.ndarray, negative_tau_results: numpy.ndarray = None) -> numpy.ndarray Transforms two time correlations from a (t,tau) representation to a (t1,t2) representation. Takes the computed correlation function with operators ordered for the positive and negative tau (t>t+tau) cases. Note that this truncates the result to maintain the same overall shape by having t2 have the same domain as t1 (truncates cases where t+tau>t1_max). If only given one matrix assumes symmetry over the tau axis. :param positive_tau_results: Computed two time correlation function in the case of operators ordered for positive tau data. :type positive_tau_results: np.ndarray :param negative_tau_results: Computed two time correlation function in the case of operators ordered for negative tau data. If None, uses the positive_tau_results, treating the observable as symmetric over the tau axis. :type negative_tau_results: np.ndarray, default: None :returns: **transformed_t1_t2_data** -- Truncated data with (t1,t2) axes. :rtype: np.ndarray .. py:function:: vacuum(time_length: float, params: QwaveMPS.parameters.InputParams) -> list[numpy.ndarray] Produces an array of vacuum time bins for a given time_length. :param time_length: Length of the vacuum pulse (units of inverse coupling). :type time_length: float :param params: Class containing the input parameters. :type params: InputParams :returns: **state** -- List of vacuum states for time_length. :rtype: list[np.ndarray] .. py:function:: wg_ground(d_t: int, bond0: int = 1) -> numpy.ndarray Waveguide vacuum state for a single time bin. :param d_t: Size of the truncated Hilbert space of the light field. :type d_t: int :param bond0: Initial size of the bond dimension. :type bond0: int, default: 1 :returns: **state** -- Waveguide vacuum state. :rtype: ndarray