Cal. Penal Code § 1170.18
(b) Upon receiving a petition under subdivision (a), the court shall determine whether the petitioner satisfies the criteria in subdivision (a). If the petitioner satisfies the criteria in subdivision (a), the petitioner’s felony sentence shall be recalled and the petitioner resentenced to a misdemeanor pursuant to Sections 11350, 11357, or 11377 of the Health and Safety Code, or Section 459.5, 473, 476a, 490.2, 496, or 666 of the Penal Code, as those sections have been amended or added by this act, unless the court, in its discretion, determines that resentencing the petitioner would pose an unreasonable risk of danger to public safety. In exercising its discretion, the court may consider all of the following:
(o)
(1) A person who is committed to a state hospital after being found not guilty by reason of insanity pursuant to Section 1026 may petition the court to have their maximum term of commitment, as established by Section 1026.5, reduced to the length it would have been had the act that added this section been in effect at the time of the original determination. Both of the following conditions are required for the maximum term of commitment to be reduced.