An equiatomic nickel–titanium shape-memory alloy specimen subjected to a uniaxial tensile load undergoes a two-step phase transformation under stress, from austenite (A) to a rhombohedral phase (R) and further to martensite (M) variants. The pseudo-elasticity that goes accompanies the phase transformation induces spatial inhomogeneity. To unravel the spatial distribution of the phases, in situ X-ray diffraction analyses are performed while the sample is under tensile load. However, the diffraction spectra of the R phase, as well as the extent of potential martensite detwinning, are not known. A novel algorithm, based on a proper orthogonal decomposition and incorporating inequality constraints, is proposed in order to map out the different phases and simultaneously yield the missing diffraction spectral information. An experimental case study illustrates the methodology.