Students face diverse pathways as they journey through undergraduate study. The analysis of student course records can untangle common patterns in course progression, and identify group trends in student outcomes. The current work examines the relationship between gender and undergraduate physics study, using course records from over nine thousand students who enrolled in physics at the University of Auckland, spanning a six year period. Science capital, a concept related to the Bourdieusian notions of capital and habitus, was employed as a research framework. Physics students' demographic and course records were analyzed to find out whether there were gender differences in their subject selection, course performance, and confidence. At stage one, gender differences were not present among highly academically prepared students, for whom school type was a better predictor of course outcome. However, of those students who were less academically prepared at stage one, male students tended to outperform female students. Female students were also more likely to take to take an introductory physics course before an advancing course, compared to male students, after controlling for academic preparation. Subsequent to taking a stage one physics course, female students were more likely to take further courses in life science subjects, while male students were more likely to take physical science subjects. We relate these findings to Bourdieu's concept of habitus --- a potential mechanism by which socio-cultural factors disproportionately discourage female students from seeing physics as a realistic study option. Thus, habitus may influence both their performance within a course and their choice of subsequent course. Taken together, our findings suggests that the female embodiment of science capital may not be as valued in the physical sciences as it is in the life sciences.