Building Brain–Machine Interfaces to Restore Neurological Functions -- Methods for Neural Ensemble Recordings