def main(path): ids = [1282, 1285, 1287, 1168, 1035, 1037, 1298, 1299, 1241, 792] images1 = Images.load_group(2) images = {i: images1.images[i] for i in ids} images = Images(3, images, images1.next_id, description='Images uploaded to panoptes staging project') print(path) pan.Uploader._client = pan.Panoptes( login='******', endpoint='https://panoptes-staging.zooniverse.org') images.upload_subjects(path)
def unlink(group): print('Unlinking subjects') images = Images.load_group(group) to_remove = [] for i in images.iter(): if i.zoo_id is not None: to_remove.append(i.zoo_id) i.zoo_id = None print('Unlinking %d subjects' % len(to_remove)) if len(to_remove) > 0: uploader = panoptes.Uploader(muon.config.project, group) uploader.unlink_subjects(to_remove) images.save_group(overwrite=True)
def main(): images = Images.load_group(0) uploader = pan.Uploader(5918, 0) print('Updating metadata') for subject in uploader.subject_set.subjects: print(subject) image = images.images[subject.metadata['id']] print(image) print(subject.metadata) subject.metadata = image.dump_manifest() print(subject.metadata) subject.save() print('done')
def main(): images = Images.load_group(0) to_remove = [] for image in images.images: if image.metadata['cluster'] == 0: to_remove.append(image) for i in to_remove: print(i) images.remove_images([i.id for i in to_remove]) uploader = pan.Uploader(5918, images.group) uploader.unlink_subjects([i.zoo_id for i in to_remove]) images.save_group(True) import code code.interact(local=locals())
def main(): for g in [1, 2]: images = Images.load_group(g) for image in images.iter(): N = len(image.subjects) cols = 10 rows = math.ceil(N/10) image.metadata.update({ 'figure': { 'cols': cols, 'rows': rows, 'height': 2*rows, 'width': 2*cols, 'dpi': 100, 'offset': 0.03*(2*cols), 'beta_image': True, } }) images.save_group(overwrite=True)
def test(subjects): subjects = pickle.load(open(subjects, 'rb')) images = Images.new(subjects) interact(locals())
def list(): groups = Images._list_groups() print('%d groups in images file:' % len(groups)) print(' '.join(groups))
def upload(group, path): images = Images.load_group(group) images.upload_subjects(path) interact(locals())