The estimation of the mean function depends on the underlying FPCA implementation.
refund uses spline smoothing (as it makes extensive use of the package
mgcv), while other packages like
fdapace use locally weighted linear smoothers. A simple Python-based FPCA implementation I have found here also uses local-linear smoothing.
Both approaches (i.e. using splines or locally weighted linear smoothers) are equally valid as they provide a non-parametric estimate of the mean trend.
fdapace comes with a vignette that might come in as handy as a general blue-print on how to make an overall FPCA routine.
As you make a particular hint to MATLAB/Python I would suggest looking at the MATLAB package PACE which is developed by the same people behind
fdapace. The canonical "PACE" reference is Functional Data Analysis for Sparse Longitudinal Data by Yao, Mueller, and Wang (2005). I am unaware of any widely used Python FDA packages,
In general, Functional Data Analysis involves a lot of smoothing. In many cases core practical differences between methodologies are actually different smoothing approaches.