Added set_stim method adapted from Ammars code
Added imports (strangely, python needs these...) and formatted/removed prints