Waking up in a panic sure sounds like possible periodic breathing a/k/a Cheyenne Stokes a/k/a altitude-relates sleep apnea.

My first and worst experience with this was at White Mountain TH. Had not used Diamox previously and was carrying it purely "just in case." Kept waking up all night long, heart beating, etc. (had spent the prior night at 10,000' with no problems). Finally, woke up thinking I was drowning/gasping for breath and realized what was going on. Popped a Diamox (125 mg) and within 45 minutes was sleeping like a baby. Since then, I've experimented with dosage at different altitudes and learned a lot about what is too little and what is just right for me -- which appears to be somewhat altitude dependent. But, for dealing with periodic breathing, Diamox really works for me.

On Kilimanjaro, I also used it to successfully head off AMS that very hit hard at 16,000' the afternoon before summit attempt (3 doses of 62.5 mg each, 6 hours apart).

So I use it primarily for periodic breathing, though at very high altitudes (Everest Base Camp/Gorek Shep Kili) it has helped me deal with incipient, or, in that one case on Kili, full blown, AMS.

Meanwhile, where no sleeping at high altitudes (i.e., above 11,000') is required, I've summitted 14,000+ without any need for Diamox at all (e.g., Mt. Shasta). Sleeping altitude is the key issue for me.

Yes, your experience may differ.