In a method for controlling an expiratory valve in a ventilator during expiration, including a stage in which the expiratory valve is opened almost completely for a first interval. The image sensor includes a 2-D photodetector array that has a plurality of photodetector pixels that provides sensitivity to the UV band. A mask core is mounted in the body.