the present invention proposes a method for modulating refractive indices of optical fiber gratings , wherein the uv exposure on a least one assigned location of an optical fiber grating is divided into to two uv shots , and the intensities or phases of the two uv shots , which expose the location sequentially , are controlled to make the total exposure intensity of one assigned location maintained at a fixed value , whereby the interference fringes , which are created by a superposition of the two uv shots , have fixed phases and adjustable intensities , and whereby the dc index of the optical fiber grating maintains fixed and the ac index independently adjustable .