Exciton wave functions and optical properties in a grating of quantum-well wires