Skip to content

Commit

Permalink
Conda package (#2)
Browse files Browse the repository at this point in the history
* added conda recipe to create data package

* add build script for linux

Co-authored-by: Edoardo Pasca <[email protected]>
  • Loading branch information
paskino and Edoardo Pasca authored May 11, 2021
1 parent 77bfd47 commit c51cfb4
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd %RECIPE_DIR%\..
%PYTHON% setup.py install
2 changes: 2 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd $RECIPE_DIR/..
$PYTHON setup.py install
16 changes: 16 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package:
name: cil-data
version: 21.0.0

build:
number: 0

requirements:

build:
- python

about:
home: http://www.ccpi.ac.uk/cil
license: Apache 2.0 License
summary: 'CCPi Core Imaging Library'
47 changes: 47 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# CCP in Tomographic Imaging (CCPi) Core Imaging Library (CIL).

# Copyright 2017 UKRI-STFC
# Copyright 2017 University of Manchester

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from distutils.core import setup
import os
import sys


cil_version='21.0.0'

setup(
name="cil-data",
version=cil_version,
data_files = [('share/cil', [ '24737_fd_normalised.nxs',
'boat.tiff',
'camera.png',
'peppers.tiff',
'rainbow.png',
'resolution_chart.tiff',
'shapes.png'
])],

# metadata for upload to PyPI
author="CCPi developers",
maintainer="Edoardo Pasca",
maintainer_email="[email protected]",
description='CCPi Core Imaging Library - Example Data',
license="Apache v2.0",
keywords="Dataset",
url="http://www.ccpi.ac.uk/cil", # project home page, if any

)
22 changes: 22 additions & 0 deletions test/manual_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os, sys
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image

data_dir = os.path.abspath(
os.path.join(sys.prefix, 'share','cil')
)

pics = ['boat.tiff', 'camera.png', 'rainbow.png', 'resolution_chart.tiff', 'shapes.png']
for which in pics:
dpath = os.path.join(data_dir, which)
with Image.open(dpath) as f:
print("opening {}".format(dpath))
bands = f.getbands()
if len(bands) > 1:
if len(bands) == 4:
f = f.convert('RGB')
bands = f.getbands()
plt.imshow(f)
plt.show()

0 comments on commit c51cfb4

Please sign in to comment.