Upload data files

This Jupyter notebook shows how to upload data files to be converted to [Photon-HDF5](http://photon-hdf5.org) format.

Please send feedback and report any problems to the [Photon-HDF5 google group](https://groups.google.com/forum/#!forum/photon-hdf5).

NOTE Uploading data files is only necessary when running the notebook online.

Files under 35 MB

Data files up to 35 MB you can be directly uploaded from the dashboard. Just go back to the Home Tab and click on the Upload button on the top right. Or, alternatively, you can use the method below even with small files.

Files over 35 MB

For large files (>35 MB) the upload button will not work. In this case you have to upload the file somewhere on the internet first, and then copy the file URL in the cell below to download it:

In [ ]:
url = 'https://ndownloader.figshare.com/files/3350672'

For example, the previous URL will download one of our example files, specifically a PicoQuant HT3 file (which you can then convert with the HT3 notebook). Other example data files are available on figshare.


Once you have copied the URL in the previous cell, you can download the file by running this notebook: go to menu Cell -> Run All, then follow the download progress at the end of this notebook.

In [ ]:
import sys
def download(url):
    """Download a file from `url` saving it to disk."""
    import urllib.request

    # Check if the URL is valid
    print('URL:  %s' % url)
        response = urllib.request.urlopen(url)
    except urllib.error.URLError as e:
        print('Wrong URL.\n\nError:\n%s\n' % e)
    # Download the file
    filename = response.geturl().split('/')[-1]
    print('File name:  %s' % filename)
    def _report(blocknr, blocksize, size):
        current = (blocknr + 1) * blocksize / 2**20
            "\rDownloaded {0:4.1f} / {1:4.1f} MB".format(current, size/2**20))
    urllib.request.urlretrieve(url, filename, _report)
    print('\nDownload completed, file saved as "%s".' % filename)
In [ ]:

Once the file is downloaded, you can go back to the dashboard ("Home" tab) and open the notebook for the file type you want to convert.