Finally, I got the script done and it works just marvelously...
Some debugging tips:
1. You have to check if each crossing is captured correctly eye by eye;
2. First check if the obtained EH, EW of each eye are correct. Then go down into the script part corresponding to the erred result to find out why;
3. All 0s eyes dont matter. They are legitimate to exist. I never seen all 1s eyes so far.
In sum, the steps of plotting eye diagram are: Select phases - Cut - Overlap.