def get_operator_systemathics(self): """ Return the operator of the acquisition. Note that the operator is only linear if the scene temperature is differential (absolute=False). """ distribution = self.get_distribution_operator() temp = self.get_unit_conversion_operator() aperture = self.get_aperture_integration_operator() filter = self.get_filter_operator() projection = self.get_projection_operator() hwp = self.get_hwp_operator() polarizer = self.get_polarizer_operator() integ = self.get_detector_integration_operator() trans_inst = self.instrument.get_transmission_operator() trans_atm = self.scene.atmosphere.transmission response = self.get_detector_response_operator() with rule_manager(inplace=True): H_t = CompositionOperator([ response, trans_inst, integ, polarizer_t, hwp_t * projection, filter, aperture, trans_atm, temp, distribution ]) H_r = CompositionOperator([ response, trans_inst, integ, polarizer_t, hwp_r * projection, polarizer_r, hwp_t * projection, filter, aperture, trans_atm, temp, distribution ]) H = H_t + H_r if self.scene == 'QU': H = self.get_subtract_grid_operator()(H) return H
def func(nops): ops = [ DiscreteDifferenceOperator(axis=axis,shapein=(2,3,4,5)) \ for axis in range(nops) ] model = CompositionOperator(ops) assert model.T.T is model v = np.arange(2*3*4*5.).reshape(2,3,4,5) a = model.T(v) b = v.copy() for m in ops: b = m.T(b) c = model.T(v,v) assert np.all(a == b) and np.all(b == c)
def test_composite(): global counter counter = 0 proxy_lists = [ get_operator(proxy_list, attr) for attr in ('', 'C', 'T', 'H', 'I', 'IC', 'IT', 'IH') ] ref_lists = [ get_operator(ref_list, attr) for attr in ('', 'C', 'T', 'H', 'I', 'IC', 'IT', 'IH') ] op = AdditionOperator(CompositionOperator(_) for _ in zip(*proxy_lists)) ref = AdditionOperator(CompositionOperator(_) for _ in zip(*ref_lists)) assert_same(op.todense(), ref.todense()) assert_equal(counter, nproxy * op.shapein[0])
def get_operator(self): """ Return the acquisition model H as an operator. """ if self._operator is None: self._operator = CompositionOperator([ BlockColumnOperator( [self.instrument.get_operator(self.sampling[b], self.scene) for b in self.block], axisin=1), self.scene.get_distribution_operator(self.comm)]) return self._operator
def get_operator(self): """ Return the operator of the acquisition. Note that the operator is only linear if the scene temperature is differential (absolute=False) """ distribution = self.get_distribution_operator() temp = self.get_unit_conversion_operator() aperture = self.get_aperture_integration_operator() projection = self.get_projection_operator() hwp = self.get_hwp_operator() polarizer = self.get_polarizer_operator() filter = self.get_filter_operator() integ = self.get_detector_integration_operator() response = self.get_detector_response_operator() convol = self.instrument.get_convolution_transfer_operator() with rule_manager(inplace=True): H = CompositionOperator([ response, integ, filter, polarizer, hwp * projection, aperture, convol, temp, distribution ]) if self.scene == 'QU': H = self.get_subtract_grid_operator()(H) return H
def check(group, expected): actual = str(CompositionOperator(group)) if '**2**2' in actual: raise SkipTest assert_equal(str(CompositionOperator(group)), expected)
def test_power_rule_comp(): ops = (ReciprocalOperator(), SqrtOperator(), SquareOperator(), PowerOperator(2.5)) op = CompositionOperator(ops) assert_is_type(op, PowerOperator) assert_equal(op.n, -2.5)
def func(ops, expected_types, expected_values): op = CompositionOperator(ops) assert_eq([type(o) for o in op.operands], expected_types) assert_eq([get_val(o) for o in op.operands], expected_values)
def func(ops, r): op = CompositionOperator(ops) assert_same(op.todense(), r, atol=5)