def calc_L_curve(model, timedata, ax=None, plot=False, nLam=150, lam_max=
    100.0, lam_min=0.001):
    """
	Function to calculate the L-curve for a given model and timedata
	instance in order to choose the best-fit smoothing parameter, `lambda`.

	Parameters
	----------
	model : rp.Model
		``rp.Model`` instance containing the A matrix to use for L curve 
		calculation.

	timedata : rp.TimeData
		``rp.TimeData`` instance containing the time and fraction remaining
		arrays to use in L curve calculation.

	Keyword Arguments
	-----------------
	ax : None or matplotlib.axis
		Axis to plot on. If `None` and ``plot = True``, automatically 
		creates a ``matplotlip.axis`` instance to return. Defaults to 
		`None`.

	plot : Boolean
		Tells the method to plot the resulting L curve or not.

	lam_min : int
		Minimum lambda value to search. Defaults to 1e-3.

	lam_max : int
		Maximum lambda value to search. Defaults to 1e2.

	nLam : int
		Number of lambda values to consider. Defaults to 150.

	Returns
	-------
	lam_best : float
		The calculated best-fit lambda value.
		
	axis : None or matplotlib.axis
		If ``plot = True``, returns an updated axis handle with plot.
	
	Raises
	------
	ScalarError
		If `lam_max` or `lam_min` are not int or float.

	ScalarError
		If `nLam` is not int.

	See Also
	--------
	Daem.calc_L_curve
		Instance method for ``calc_L_curve``.

	References
	----------
	[1] D.C. Forney and D.H. Rothman (2012) Inverse method for calculating
		respiration rates from decay time series. *Biogeosciences*, **9**,
		3601-3612.

	[2] P.C. Hansen (1994) Regularization tools: A Matlab package for analysis
		and solution of discrete ill-posed problems. *Numerical Algorithms*, 
		**6**, 1-35.
	"""
    a = model.calc_L_curve(timedata, ax=ax, plot=plot, nLam=nLam, lam_max=
        lam_max, lam_min=lam_max)
    return a
