GithubHelp home page GithubHelp logo

tracepy's People

Contributors

huangziwei avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tferr

tracepy's Issues

get_df_paths2 stack a wrong connect_to_at point to the original path

def get_df_paths2(df_trace, soma_info):
    
    all_paths = get_all_paths(df_trace)
    df_paths = pd.DataFrame(list(all_paths.items()), columns=['path_id', 'path'])
    # df_paths['path2'] = ''

    connect_to_all    = []
    connect_to_at_all = []

    for i, key in enumerate(all_paths.keys()):

        if connected_with_soma(all_paths, key, soma_info, threshold=5):

            connect_to    = -1
            connect_to_at = []
        else:
            connect_to, connect_to_at = get_connect_to(all_paths, key)

        connect_to_all.append(connect_to)
        connect_to_at_all.append(connect_to_at)
    
    df_paths['connect_to'] = connect_to_all
    df_paths['connect_to_at'] = connect_to_at_all
    
    df_paths.sort_values(['path_id'], ascending=[True], inplace=True)
    df_paths.index = df_paths.path_id.as_matrix()

    connected_by_all    = []
    connected_by_at_all = []
    
    for i, key in enumerate(df_paths.path_id):
        
        connected_by    = df_paths[df_paths.connect_to == key].path_id.tolist()
        connected_by_at = df_paths[df_paths.connect_to == key].connect_to_at.tolist()
    
        connected_by_all.append(connected_by)
        connected_by_at_all.append(connected_by_at)
    
    df_paths['connected_by'] = connected_by_all
    df_paths['connected_by_at'] = connected_by_at_all
    
    path2 = {}
    for path_id in df_paths.path_id:
    
        connect_to = df_paths.loc[path_id].connect_to
        path = df_paths.loc[path_id].path
        connect_to_at = df_paths.loc[path_id].connect_to_at
        
        if connect_to == -1:
            path2[path_id] = path

        else:
            if (connect_to_at == path).all(1).any():
                path2[path_id] = path
            else:
                path = np.vstack([connect_to_at, path]) # the bug is here
                path2[path_id] = path
    
    df_paths['path'] = path2.values()

    return df_paths

SNT Notebooks?

I am just opening this to mention that this is really great! SNT Users would definitely profit from this.

I was planning to write an IPython Notebook exemplifying how to analyze SNT traces (see fiji/SNT#10), but now that I came across your project, I was simply thinking to:

@huangziwei, what do you think?
Also relevant (in case you have not seen it) is https://github.com/hadim/scijava-jupyter-kernel

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.