def test_from_light_curves_no_meta(): lcs = [] for idx in range(5): lc = make_light_curve(f'test_{idx}') lc.meta = {} lcs.append(lc) dataset = lcdata.from_light_curves(lcs) assert len(dataset.meta) == 5
def make_dataset(start_idx=0, end_idx=10): lcs = [make_light_curve(f'test_{i}') for i in range(start_idx, end_idx)] dataset = lcdata.from_light_curves(lcs) dataset.meta['maskedvar'] = np.ma.masked_array( np.arange(start_idx, end_idx), mask=np.arange(start_idx, end_idx) % 2 == 0) return dataset
def test_from_light_curves_order(): # We sort the light curves in alphabetical order. Make sure that this works # correctly. lc1 = make_light_curve(object_id='1') lc2 = make_light_curve(object_id='2') lc3 = make_light_curve(object_id='3') # Add a flag to the fluxes so that we can track them. lc1['flux'][0] = 1. lc2['flux'][0] = 2. lc3['flux'][0] = 3. dataset = lcdata.from_light_curves([lc2, lc3, lc1]) assert np.all(dataset.meta['object_id'] == ['1', '2', '3']) assert dataset.light_curves[0]['flux'][0] == 1. assert dataset.light_curves[1]['flux'][0] == 2. assert dataset.light_curves[2]['flux'][0] == 3.
def test_from_light_curves(): lc = make_light_curve() dataset = lcdata.from_light_curves([lc]) assert len(dataset) == 1
def test_from_light_curves_duplicate_object_ids(): lcs = [make_light_curve('same_object_id') for i in range(2)] with pytest.raises(ValueError): lcdata.from_light_curves(lcs)