Upper-division CS&E courses and core lower-division CS&E courses with labs should be assigned a number of TAs based primarily on student enrollment. Since the number of lab sections correlate with enrollment, assigning TAs based on the number of lab sections is convenient, but does NOT imply a strict mapping of TAs to sections. A general rule is that each lab section translates to a 25% TA (i.e., one 25% TA for 25 students); two lab sections to a 50% TA or two 25% TAs, etc.
Rationale: a lab section meets for three hours/week. Average preparation time for a lab is about 1.5 hours (e.g., preparing one assignment or one in-lab set of exercises may take 5 hours, and there are typically 10 to 15 new assignments or in-lab exercises in a quarter). Grading labs/homeworks for 25 students requires about 3.5 hours. Miscellaneous tasks like helping prepare lecture quizzes, exams, and homeworks, helping grade quizzes/exams, entering grades, holding office hours, proctoring, attending occasional lectures, and detecting and following up on cheating (a task especially unique to CS&E due to the ease of copying programs) all together average about three hours per week per 25 students. That's ten hours per week total, which is what a 25% TA can work.
Courses without labs might use a formula of one 25% TA per 50 students (rather than 25), and non-core courses without intensive labs/homeworks might instead use a formula of one 25% TA per 1.5 lab sections or even per two lab sections, depending on the load on the TA.