Code Monkey home page Code Monkey logo

Comments (1)

dustinf1989 avatar dustinf1989 commented on July 16, 2024

I found out that if your files do not begin with CSC that you can change this function in combinato/util/tools.py

You can uncomment some lines if you want to make sure the code is working for you or just delete them.

def h5files(path):
    """
    highly specific tool to find all relevant h5 files
    if their names follow the CSC?, CSC?? naming convention
    """
    def sort_function(fname):
        # This function sorts files based on patterns data_CSC?????? and removes .h5 from the end
        # Why is it necessary?
        try:
            # a = int(os.path.basename(fname)[8:-3]) # For data_CSC????
            a = int(os.path.basename(fname)) # DF added: For anything
            print(a)
            return a
        except ValueError:
            return fname

    # channel_dirs = glob(os.path.join(path, 'CSC?')) # Why was this commented?
    # channel_dirs += glob(os.path.join(path, 'CSC??'))
     
    channel_dirs = [] # Get patterns based on the options file
    for pat in options['folder_patterns']:
        channel_dirs += glob(os.path.join(path, pat))
        
    # print(path)
    # print(channel_dirs)

    ret = []
    for chd in channel_dirs:
        basename = os.path.basename(chd)
        h5cand = os.path.join(chd, 'data_{}.h5'.format(basename))
        # print(h5cand, os.path.exists(h5cand))
        if os.path.exists(h5cand):
            # print(h5cand, os.stat(h5cand).st_size)
            if os.stat(h5cand).st_size > 0:
                # print('yes', os.stat(h5cand).st_size)
                ret.append(h5cand)
    # print(ret)
    # print(sort_function)
    # print(sorted(ret, key=sort_function))
    return sorted(ret, key=sort_function)****

from combinato.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.