Inference of array grammars under noise and distortion