OK, forget about Color Tables
. We'll do it with Curves layer:
Open your source image. Let's assume it has a vertical gradient like on the images you posted. Now go to Image->Image Size... Set Constrain Proportions off, Width - 1 px, Height - 256 px, Resample method - Bicubic(best for smooth gradients).Press OK.
Now go to File->Save as... and save a copy as Photoshop RAW file. In the save dialog enter some name with AMP extension(this way PS will save the file as RAW image but with AMP extension. At least this is so on Windows
). Next comes up the Photoshop RAW options dialog. Here leave the Header field 0, but check the Non-Interleaved order! Press OK and OK to warning that comes later. Now you can go back in the History panel to undo the Image Size command.
Let us go to your target image(or layer) with your grayscale map. Here add Curves layer. On this layer go to panel menu and choose Load Curves Preset.... In the dialog choose AMP file type and open the AMP file you've created in the first step. This is it!
To change the direction of the gradient add Invert layer under the Curves layer.
P.S. As of some time ago PS started adding some S curve to Curves. If it bothers you we can compensate this a little by adding yet another Curves layer over your grayscale map. In this layer add 4 points(Input, Output): (0, 0), (54,64), (127, 127), (192, 180), (255,255).
Hope this helped.