The focus can be maintained by being constantly motivated, and that may be somewhat hard. All projects have high points and low points. My P.I. once told me, You will try a reaction 100 times. Out of those 100, you will most likely fail 99 times. The one that counts is the one you get to work.
Failure is a big part of the learning experience.
The most frustrating years tend to be the third and fourth years. By the third year, it feels like one has been in graduate school long enough, but no one can see the light at the end of the tunnel. On the fourth year, one starts to worry about finishing up and what s coming next. All of these things may come as a whirlwind. Fortunately, there are many ways of getting support.