The connection between photovoltaic and photorefractive effects and the local properties of ferroelectrics