Other tests used to diagnose pulmonary hypertension include:  CT scan or MRI. Pulmonary function test, which measures the airflow in and out of your lungs. Electrocardiogram, which may reveal abnormal heart rhythms. Polysomnogram, which can help diagnose a sleep disorder like sleep apnea. Ventilation/perfusion (V/Q) scan to find out if blood clots are causing the condition.