test rescale ftn
scaling after gray
changed int to double
Scale factor implemented.