half-wave rectified gratings in PTB

Hi,

Is there anyway (e.g., CreateProceduralSineGrating) to create half-wave rectified gratings in PTB, like the image I've attached?


Thanks