示例#1
0
 def assign_subject(self):
     """
     Assign a unique subject to each teacher
     """
     subject = Subject()
     assigned_subject = subject.get_subject(subject.subjects)
     return assigned_subject
示例#2
0
 def test_bigger_then_1_attendance_list(self):
     testing_list = [0, 0, 1, 10, 2, 3]
     subject = Subject(self.proper_name, self.proper_scores, testing_list)
     present, total = subject.get_attendance()
     msg = str(total) + self.not_greater_msg + str(present) + ' for ' + str(
         testing_list)
     self.assertGreaterEqual(total, present, msg)
示例#3
0
def create_refs_and_subjects(directory_in_str, compressor, compressor_type,
                             nr_refs_files):
    refs = {}
    subjects = []
    general_directory = os.fsencode(directory_in_str)

    list_dir = os.listdir(general_directory)
    list_dir.sort()

    for dir in list_dir:
        dir_name = os.fsdecode(dir)
        sub_dir = os.path.join(directory_in_str, dir_name)
        if os.path.isdir(sub_dir):
            imgs = os.listdir(sub_dir)
            imgs.sort()
            image_files = []
            new_subject = Subject(dir_name)

            for i in imgs:
                img_dir = os.path.join(sub_dir, i)
                file = ImageFile(img_dir, compressor, compressor_type)
                if len(image_files) < nr_refs_files:
                    image_files.append(file)
                else:
                    new_subject.add_test_file(file)
            refs[dir_name] = image_files
            subjects.append(new_subject)
    return refs, subjects
示例#4
0
    def setUp(self):
        name = 'python'
        scores = [5, 4, 3, 4, 5, 3.5, 2, 2, 5, 3, 4.5]
        attendances = [1, 1, 1, 0, 1, 0, 0, 0]

        self.proper_subject_output = (name, (4, 8), sum(scores) / len(scores))
        self.testing_subject = Subject(name, scores, attendances)
示例#5
0
文件: Student.py 项目: Synowiecka/PO
 def redoSemester(self):
     zostalo = list(set(self.attended) - set(self.passed))
     subjects = self.database.get_subjects_list(zostalo)
     subs = []
     for sub in subjects:
         subject = Subject(sub[1], sub[4], sub[2], sub[0])
         subs.append(subject)
     for subject in subs:
         print("Student zdaje:")
         subject.print_subject()
         chance = ((self.wisdom + (100 - self.friend.annoy)) / 2) * (
             1.75 - subject.level)  #za drugim razem jest latwiej
         if chance > 50:
             if random.uniform(0.0, 0.4) < 0.38:  #male szanse niezdania
                 self.ects += subject.ects
                 print("Zdane")
                 self.passed.append(subject.id)
             else:
                 print("Niezdane")
                 pass
         else:
             if random.uniform(0.0, 0.6) < 0.5:
                 self.ects += subject.ects
                 print("Zdane na farcie")
                 self.passed.append(subject.id)
             else:
                 print("Niezdane nawet w drugim terminie")
                 pass
示例#6
0
class TestSubjectProperData(unittest.TestCase):
    def __init__(self, init_test):
        super(TestSubjectProperData, self).__init__(init_test)

    def setUp(self):
        name = 'python'
        scores = [5, 4, 3, 4, 5, 3.5, 2, 2, 5, 3, 4.5]
        attendances = [1, 1, 1, 0, 1, 0, 0, 0]

        self.proper_subject_output = (name, (4, 8), sum(scores) / len(scores))
        self.testing_subject = Subject(name, scores, attendances)

    def tearDown(self):
        self.proper_subject_output = None
        self.testing_subject = None

    def test_get_average_score_method(self):
        testing_value = self.testing_subject.get_average_score()
        proper_value = self.proper_subject_output[2]
        self.assertEqual(testing_value, proper_value)

    def test_get_attendance_method(self):
        testing_value = self.testing_subject.get_attendance()
        proper_value = self.proper_subject_output[1]
        self.assertEqual(testing_value, proper_value)

    def test_get_subject_name_method(self):
        testing_value = self.testing_subject.get_subject_name()
        proper_value = self.proper_subject_output[0]
        self.assertEqual(testing_value, proper_value)
示例#7
0
class subject_view:
    next_row = 0

    def __init__(self, subject_name):
        self.subject = Subject(subject_name)

        #create and place button for starting session
        self.session_button =\
            Button(root, bg ="#EE6041", text = self.subject.name, height = 10, width =20, command=self.session_button_fct)

        self.session_button.grid(row=subject_view.next_row, column=0)

        subject_view.next_row += 1

        #create field for showing time
        self.time_button =\
            Button(root, bg = "white", text = "time",  height = 10, width =20, command = self.time_button_fct )

        self.time_button.grid(row=self.next_row - 1, column=1)

    def time_button_fct(self):
        self.time_button.config(text=self.subject.cummulated_time_formatted())

    def session_button_fct(self):
        if self.subject.active_session == None:
            self.subject.start_session()
            self.session_button.config(bg="#5DC87C")
        else:
            self.subject.stop_session()
            self.session_button.config(bg="#EE6041")
示例#8
0
 def __init__(self):
     Subject.__init__(self)
     self.penlist = ["", "white", "black", "red", "yellow", "blue"]
     self.turtle = turtle.Turtle()
     self.pen_up()
     self.check = Ec().check
     self.triangle_size = 1
示例#9
0
 def test_negative_attendance_list(self):
     testing_list = [-1, 0, -1, 0, -20, 3]
     subject = Subject(self.proper_name, self.proper_scores, testing_list)
     present, total = subject.get_attendance()
     msg = '0' + self.not_greater_msg + str(present) + ' for ' + str(
         testing_list)
     self.assertGreaterEqual(present, 0, msg)
示例#10
0
文件: test.py 项目: Rrrima/DrivingSim
def generate_expdata():
	num = 107
	btots = []
	stots = []
	gtots = []
	tots = []
	ttcs = []
	ids = []
	ttc_time = []
	tbtcs = []
	tds = []
	wls = []
	error_list = []
	cpoint = []


	for i in range(num):
	    sub_id = i+1
	    try:
		    print("create subject {}".format(sub_id))
		    sub = Subject('workload',sub_id,meta_data)
		    if sub_id%2 ==0:
		    	# for the bycycle event
		        # eid = 7
		        # for the car ahead event
		        eid = 3
		    else:
		        # eid = 0
		        eid = 4
		    print("    get event data {}".format(eid))
		    tt = sub.query_by_event(eid)
		    tot_dict = tt.calculate_tot_time()
		    b,s,g,t = tot_dict.values()
		    btots.append(b)
		    stots.append(s)
		    gtots.append(g)
		    tots.append(t)
		    ttcs.append(tt.ttc)
		    ttc_time.append(tt.ttc_time)
		    cpoint.append(tt.changetime)
		    ids.append(sub_id)
		    tbtcs.append(tt.tbtc)
		    tds.append(tt.traffic_density)
		    wls.append(tt.workload)
	    except:
	        error_list.append(sub_id)
	        e = sys.exc_info()[0]
	        print(e)
	        continue

	print("="*20,"subject with error","="*20)
	print(error_list)
	print("="*20,"==================","="*20)

	df = pd.DataFrame(list(zip(ids, btots, stots, gtots, tots, ttcs,ttc_time, tbtcs,tds,wls)), 
	               columns =['subject_id','brake', 'steer','gas','tot','ttc','ttc_time','changetime','tbtc','traffic_density','workload']) 
	df.to_csv('result_workload_bicycle_addlane2.csv',index=False)
示例#11
0
 def __init__(self):
     Subject.__init__(self)
     self.graphics = GraphWin("graphics.py", 500, 500)
     self.x = 250
     self.y = 250
     self.penDown = False
     self.color = "blue"
     self.penlist = ["", "white", "black", "red", "yellow", "blue"]
     self.check = Ec().check
     self.triangle_size = 1
    def __init__(self, db_name=FILENAME):
        global lock
        self.db_name = db_name
        self.lock = lock
        Subject.__init__(self)

        if not os.access(FILEDIR, os.F_OK):
            os.makedirs(FILEDIR)
        if not os.path.exists(self.db_name):
            self.__create()
示例#13
0
    def __init__(self, subject, num_of_rows=20, num_of_cols=20, ratio=0.1):
        assert ratio >= 0 and ratio <= 1
        assert num_of_rows >= 0 and num_of_cols >= 0

        Observer.__init__(self, subject)
        Subject.__init__(self)
        self.num_of_rows = num_of_rows
        self.num_of_cols = num_of_cols
        self.round = 0
        self.map = [[1 if random() < ratio else 0 \
                     for _ in range(num_of_cols)] for _ in range(num_of_rows)]
示例#14
0
    def determine_subject_proficiency(self):
        """
        Determine how well each teacher can teach each subject
        """
        subject = Subject()
        available_subjects = subject.subjects
        subject_proficiencies = dict()
        while len(available_subjects) > 0:
            this_subject = subject.get_subject(available_subjects)
            proficiency = subject.get_subject_proficiency()
            subject_proficiencies[this_subject] = proficiency

        return subject_proficiencies
示例#15
0
    def __init__(self, root, parent, factory):
        #super(FileTable, self).__init__()
        Observer.__init__(self)
        Subject.__init__(self)

        self._root = root
        self._parent = parent
        self._factory = factory

        self._fileHash = dict()
        self._dirHash = dict()

        self._fileSelector = Selector(r"^\s*(\d+) (.*)$")
        self._dirSelector = Selector(r"^\s*(.*)/$")
示例#16
0
    def __init__(self, root, parent, factory):
        #super(FileTable, self).__init__()
        Observer.__init__(self)
        Subject.__init__(self)

        self._root = root
        self._parent = parent
        self._factory = factory

        self._fileHash = dict()
        self._dirHash = dict()

        self._fileSelector = Selector(r"^\s*(\d+) (.*)$")
        self._dirSelector = Selector(r"^\s*(.*)/$")
示例#17
0
    def __init__(self, ftp, fileListDir, lock=_threading.Lock()):
        if not isinstance(ftp, FTP):
            raise TypeError("gave 'ftp' parameters was not FTP.")

        #super(Listener, self).__init__()
        Subject.__init__(self)
        _threading.Thread.__init__(self)
        # 如果使用了多个Listener,并且他们都使用同一个lftp程序
        # 那么请使用同一个线程锁(lock)
        self.lock = lock
        # Notice filetype code in python3
        self.setName("{ftpHost}:{ftpDir}".format(ftpHost=ftp.host, ftpDir=fileListDir.encode("utf-8")))

        self._ftpFileListDir = fileListDir
        self._localFilelist = ''
        self._ftp = ftp
示例#18
0
    def __init__(self, subject_name):
        self.subject = Subject(subject_name)

        #create and place button for starting session
        self.session_button =\
            Button(root, bg ="#EE6041", text = self.subject.name, height = 10, width =20, command=self.session_button_fct)

        self.session_button.grid(row=subject_view.next_row, column=0)

        subject_view.next_row += 1

        #create field for showing time
        self.time_button =\
            Button(root, bg = "white", text = "time",  height = 10, width =20, command = self.time_button_fct )

        self.time_button.grid(row=self.next_row - 1, column=1)
示例#19
0
文件: Student.py 项目: Synowiecka/PO
 def runSemester(self):
     print("SEMESTR " + str(self.semester))
     subjects = self.database.get_subjects_for(self.semester)
     studSubjects = []
     for subject in subjects:
         sub = Subject(subject[1], subject[4], subject[2], subject[0])
         studSubjects.append(sub)
     for subject in studSubjects:
         print("Student zdaje:")
         self.attended.append(subject.id)
         subject.print_subject()
         chance = ((self.wisdom + (100 - self.friend.annoy)) / 2) * (
             1.35 - subject.level)  #1.1 im wiecej tym latwiej
         if chance > 50:
             if random.uniform(0.0, 0.4) < 0.38:  #male szanse niezdania
                 self.ects += subject.ects
                 print("Zdane")
                 self.passed.append(subject.id)
             else:
                 print("Niezdane")
                 pass
         else:
             if random.uniform(0.0, 0.6) < 0.4:  #66.6% szans na zdanie
                 self.ects += subject.ects
                 print("Zdane na farcie")
                 self.passed.append(subject.id)
             else:
                 print("Niezdane nawet w drugim terminie")
                 pass
示例#20
0
    def add_subject_instance(self, x, dictionary_of_subjects, rownum):
        '''
		To create subject objects within the activity log
		'''
        match = False  #flag variable to see if subject instance was found
        temp = SubjectInstance(
            x['course_name'], x['main_code'], rownum, x['year'], x['semester'],
            x['location']
        )  #create the current row into a temp subject instance object
        if (
                temp.name not in dictionary_of_subjects
        ):  #if the subject does not yet exist, create the subject key entry and add the subject instance to it
            dictionary_of_subjects[temp.name] = (Subject(
                x.course_name, x.main_code))
            (dictionary_of_subjects[temp.name]).subject_instances.append(temp)
            return id(temp)

        else:  #subject exists in dictionary
            subject_temp = dictionary_of_subjects[temp.name]
            subject_instances_temp = subject_temp.subject_instances
            for x in subject_instances_temp:
                if temp.equals(x):
                    # print("duplicate")
                    return id(x)
                    match = True
                    break
            if (match == False):
                subject_instances_temp.append(temp)
                return id(
                    temp
                )  #return unique id of the inserted / matched subject instance
示例#21
0
    def find_subjects(self):
        '''takes subjects_dir and returns a list and hash of subject objects for all the folders inside 
        as (subjectlist,subjectdict)=__findSubjects__(subjects_dir)'''

        try:
            subjectFiles = os.listdir(self.path)
        except:
            warnings.warn("\nCould not list files in: " + self.path)
            return

        self.subjectlist = []
        self.subjects = {}

        for file in subjectFiles:
            fulldir = os.path.join(self.path, file)
            if (not os.path.isdir(fulldir)):
                continue
            m = self.config.__subjectfolderREC__.match(file)
            if m:
                newsubject = Subject(self, m.group(0))
            else:
                raise Exception('Index: ' + self.config.name +
                                ' at location ' + self.path +
                                '\nCould not parse subject ' + fulldir +
                                '\nShould it be in this directory?\n')
            self.subjectlist.append(newsubject)
            self.subjects[newsubject.subid] = newsubject
示例#22
0
def phase_base_population(prev_population):
    if prev_population == None:
        population = [Subject(configs) for _ in range(configs.population_size)]
    else:
        population = prev_population

    #print_phase_result(1, "População base", population)
    return population
示例#23
0
    def create_object(self, node_type):
        """
        Returns an empty object of the node_type provided. It must be a valid object,
        or else an exception is raised. 
        
        Args:
            node_type (str): The type of object desired. 
        
        Returns:
            A object of the specified type. 
        """
        self.logger.debug("In create_object. Type: %s" % node_type)

        node = None
        if node_type == "project":
            from Project import Project
            self.logger.debug("Creating a Project.")
            node = Project()
        elif node_type == "visit":
            from Visit import Visit
            self.logger.debug("Creating a Visit.")
            node = Visit()
        elif node_type == "subject":
            from Subject import Subject
            self.logger.debug("Creating a Subject.")
            node = Subject()
        elif node_type == "sample":
            from Sample import Sample
            self.logger.debug("Creating a Sample.")
            node = Sample()
        elif node_type == "study":
            from Study import Study
            self.logger.debug("Creating a Study.")
            node = Study()
        elif node_type == "wgs_dna_prep":
            from WgsDnaPrep import WgsDnaPrep
            self.logger.debug("Creating a WgsDnaPrep.")
            node = WgsDnaPrep()
        elif node_type == "16s_dna_prep":
            from SixteenSDnaPrep import SixteenSDnaPrep
            self.logger.debug("Creating a SixteenSDnaPrep.")
            node = SixteenSDnaPrep()
        elif node_type == "16s_raw_seq_set":
            from SixteenSRawSeqSet import SixteenSRawSeqSet
            self.logger.debug("Creating a SixteenSRawSeqSet.")
            node = SixteenSRawSeqSet()
        elif node_type == "wgs_raw_seq_set":
            from WgsRawSeqSet import WgsRawSeqSet
            self.logger.debug("Creating a WgsRawSeqSet.")
            node = WgsRawSeqSet()
        elif node_type == "16s_trimmed_seq_set":
            from SixteenSTrimmedSeqSet import SixteenSTrimmedSeqSet
            self.logger.debug("Creating a SixteenSTrimmedSeqSet.")
            node = SixteenSTrimmedSeqSet()
        else:
            raise ValueError("Invalid node type specified: %" % node_type)

        return node
示例#24
0
 def setUp(self):
     self.subject = Subject()
     self.model = Model(self.subject, 4, 4, 0.5)
     self.model.map = [
         [1, 0, 0, 1],
         [0, 0, 1, 0],
         [1, 0, 1, 0],
         [0, 0, 1, 1],
     ]
示例#25
0
 def setUp(self):
     test_data = TestDataInit.students_data_factory()[0]
     student, self.proper_student_output = test_data
     self.courses = TestDataInit.courses_data_factory()
     subjects = list()
     for key in student[2]:
         grades = student[2][key][0]
         attendances = student[2][key][1]
         subjects.append(Subject(key, grades, attendances))
     self.testing_student = Student(student[0], student[1], subjects)
示例#26
0
 def dispatch_dir(cls, src: Union[str, PathLike]) -> PathLike:
     # super().__init__(src)
     mapper = (
         (src in Path(str(cls.bids_root)).parents, Path(src)),
         (cls.is_bids_root, BIDSDataset(src)),
         (cls.is_subject, Subject(src)),
         (cls.is_session, Session(src)),
         (cls.is_datatype, Datatype(src)),
         (cls.is_file, bids_file(src))
     )
     return next(filter(lambda i: all(i), mapper))[1]
示例#27
0
 def parse_nccd_file(self, filename):
     file = open(filename, 'r')
     lst = list(file.readlines())
     for line in lst[0:len(lst) - 1]:
         row = line.strip().split(" : ")
         id = 's' + row[0]
         subject = Subject(id)
         self.subjects.append(subject)
         self.dict[id] = [
             's' + value for value in row[1].split(' -> ')[0].split()
         ]
示例#28
0
def preprocessSubject(data):
    isPractice = True if data[2] != "0" else False

    # 강의실이 미리 배정되어 있다면
    # 해당되는 인스턴스를 찾는다.
    lectureRoom = None
    if data[-2] != "" and data[-2] != "X":
        for r in roomsForPractice:
            if data[-2] == r.name:
                lectureRoom = r
                break
        # 위에서 찾지 못했다면
        # 해당 과목은 정보보호개론 or 산업체취창업특강이므로
        # 담헌실학관 102호를 넣어준다
        if lectureRoom == None:
            lectureRoom = roomsForTheory[-1]

    # 이론 과목
    subject = Subject(
        name = data[0],
        time = int(data[1]),
        isPractice = False,
        number = data[3],
        capacity = int(data[4]),
        lectureRoom = lectureRoom,
        startTime = data[-1]
    )
    theorySubjects[subject.ID] = subject

    # 실습 과목
    if isDesignSubject(subject) == False and isPractice:
        practice = Subject(
            name = data[0],
            time = int(data[2]),
            isPractice = True,
            number = data[3],
            capacity = int(data[4]),
            lectureRoom = lectureRoom,
            startTime = None
        )
        practiceSubjects[practice.ID] = practice
class TestObserverPattern(TestCase):
    def setUp(self):
        self.subject = Subject()
        self.observers = [Observer(self.subject) for _ in range(3)]

    def test_attach(self):
        ob4 = Observer(self.subject)
        self.subject.attach(ob4)
        self.assertEqual(self.subject.observers[-1],
                         ob4, 'Should append new observer')

    def test_detach(self):
        ob2 = self.subject.observers[1]
        self.subject.detach(ob2)
        self.assertNotIn(ob2, self.subject.observers,
                         'Should detach observer')

    def test_notify(self):
        with mock.patch('Observer.Observer.update') as mock_update:
            try:
                self.subject.notify()
            except NotImplementedError:
                pass

            mock_update.assert_has_calls([mock.call() for _ in range(3)])
    def __init__(self, Frame, lecText, tutText=None):
        self.cd, self.dy, self.stH, self.stM, self.enH, self.enM = lecText.split(
            ",")
        if not (tutText == None):
            #splitting string
            self.dy1, self.stH1, self.stM1, self.enH1, self.enM1 = tutText.split(
                ",")

            #intializing Subject object
            self.SubObj = Subject(
                self.cd, self.dy, int(self.stH), int(self.stM), int(self.enH),
                int(self.enM),
                Subject(self.cd, self.dy1, int(self.stH1), int(self.stM1),
                        int(self.enH1), int(self.enM1)))

            #intializing Subejct Label
            self.SubLabel = tk.Label(
                Frame,
                text="Lecture : " + self.SubObj.code + ' ' + self.SubObj.day +
                ' ' + str(self.SubObj.startTime) + ' to ' +
                str(self.SubObj.endTime) + ' Tut : ' + self.SubObj.link.day +
                ' ' + str(self.SubObj.link.startTime) + ' to ' +
                str(self.SubObj.link.endTime),
                pady=10)

        else:

            #intializing Subject object
            self.SubObj = Subject(self.cd, self.dy, int(self.stH),
                                  int(self.stM), int(self.enH), int(self.enM))

            #intializing Subejct Label
            self.SubLabel = tk.Label(Frame,
                                     text="Lecture : " + self.SubObj.code +
                                     ' ' + self.SubObj.day + ' ' +
                                     str(self.SubObj.startTime) + ' to ' +
                                     str(self.SubObj.endTime),
                                     pady=10)
示例#31
0
 def create_subject(self):
     """
     Returns an empty Subject object. 
     
     Args:
         None
     
     Returns:
         A Subject object. 
     """
     self.logger.debug("In create_subject.")
     from Subject import Subject
     subject = Subject()
     return subject
示例#32
0
 def add_subject(self, subid, warn=False):
     m = self.config.__subjectfolderREC__.match(subid)
     if not m:
         warnings.warn(self.name + '::Did not create subject with subid ' +
                       subid + '\n::Subject Regex did not match.\n' +
                       'Regex:: ' + self.config.__subjectfolderRE__)
         return False
     elif subid not in self.subjects:
         newsubject = Subject(self, subid)
         self.subjectlist.append(newsubject)
         self.subjects[newsubject.subid] = newsubject
         return True
     elif warn == True:
         warnings.warn('Did not create subject with subid ' + subid +
                       '::Already Exists.')
         return False
    def loop_participants(self, subj_list):

        for subj in subj_list:

            try:

                z = Subject(
                        # What data to load in
                        subjectID=subj,
                        load_ecg=True, load_ankle=False, load_wrist=True,
                        load_raw_ecg=False, load_raw_ankle=False, load_raw_wrist=False,
                        from_processed=True,

                        # Model parameters
                        rest_hr_window=30,
                        n_epochs_rest_hr=30,
                        hracc_threshold=30,
                        filter_ecg=True,
                        epoch_len=15,

                        # Data files
                        raw_edf_folder="/Users/kyleweber/Desktop/Data/OND07/EDF/",
                        crop_index_file="/Users/kyleweber/Desktop/Data/OND07/Tabular Data/CropIndexes_All.csv",
                        treadmill_log_file="/Users/kyleweber/Desktop/Data/OND07/Tabular Data/Treadmill_Log.csv",
                        demographics_file="/Users/kyleweber/Desktop/Data/OND07/Tabular Data/Demographics_Data.csv",
                        sleeplog_file="/Users/kyleweber/Desktop/Data/OND07/Tabular Data/SleepLogs_All.csv",
                        output_dir="/Users/kyleweber/Desktop/Data/OND07/Processed Data/",
                        processed_folder="/Users/kyleweber/Desktop/Data/OND07/Processed Data/Model Output/",
                        write_results=False)

                index_len = min([len(z.wrist.epoch.svm), len(z.ecg.epoch_validity), len(z.nonwear.status)])

                self.invalid_counts.append(np.asarray([z.wrist.epoch.svm[i] for i in range(index_len) if
                                                       z.ecg.epoch_validity[i] == 1 and
                                                       z.nonwear.status[i] == 0]).mean())
                self.valid_counts.append(np.asarray([z.wrist.epoch.svm[i] for i in range(index_len) if
                                                     z.ecg.epoch_validity[i] == 0 and
                                                     z.nonwear.status[i] == 0]).mean())

                self.ids.append(subj)

            except:
                self.passed_ids.append(subj)
                pass

        self.df = pd.DataFrame(list(zip(self.ids, self.invalid_counts, self.valid_counts)),
                               columns=["ID", "InvalidECG", "ValidECG"])
示例#34
0
文件: Study.py 项目: JAX-GM/cutlass
    def subjects(self):
        """
        Return iterator of all subjects that participate in this study.
        """
        self.logger.debug("In subjects.")

        linkage_query = '"{}"[linkage.participates_in]'.format(self.id)
        query = iHMPSession.get_session().get_osdf().oql_query

        for page_no in count(1):
            res = query(Study.namespace, linkage_query, page=page_no)
            res_count = res['result_count']

            for doc in res['results']:
                yield Subject.load_subject(doc)

            res_count -= len(res['results'])

            if res_count < 1:
                break
 def setUp(self):
     self.subject = Subject()
     self.observers = [Observer(self.subject) for _ in range(3)]