(a) The procedure provided in this chapter shall also be followed, insofar as it is applicable, in any case in which the insanity of the convicted defendant is alleged as a ground for postponing or not carrying out execution of any sentence imposed as part of the judgment of conviction of the defendant.
(b) In such cases, a hearing shall be held in the manner provided by law, but the evidence provided for in this subchapter shall be given at the hearing.