Yes, so I think making _find_sources a method, making it smarter so
that it handles x-arg and x-y arg score funcs
and making it update the .sorted_by attribute would do the trick.
Shouldn't be too much of an effort.
As a result we would drop sort_sources and we would get around
ica.argsort_sources_epochs_very_long_method_name(epochs) ^^

Wdyt?

On Mon, Oct 29, 2012 at 4:27 PM, Denis-Alexander Engemann
<denis.engemann@gmail.com> wrote:
> 2012/10/29 Alexandre Gramfort <notifications@github.com>
>>
>> In mne/artifacts/ica.py:
>>
>> > +        Returns
>> > +        -------
>> > +        fig : instance of pyplot.Figure
>> > +        """
>> > +
>> > +        sources = self.get_sources_epochs(epochs)
>> > +        fig = plot_ica_panel(sources[epoch_idx], start=start,
>> > stop=stop,
>> > +                             n_components=n_components,
>> > source_idx=source_idx,
>> > +                             ncol=ncol, nrow=nrow)
>> > +        if show:
>> > +            fig.show()
>> > +
>> > +        return fig
>> > +
>> > +    def find_sources_raw(self, raw, target, sources=None,
>> > score_func=None,
>> > +                         start=None, stop=None, sort_func=stats.skew):
>>
>> remark: can you convert your emails to text as it appears always a mess
>> when you reply to comments by email. I always have to reformat to answer :(
>
> Sorry, wasn't aware, bad gmail. Is it better now?
>
>>> I'm afraid the API get's shaken... But yes. So just to draw a tiny
>>> dependency-map of the method relations:
>> yes
>>> '-->' for left invokes right: (get_sources, pick_sources) --.>
>>> sort_sources (plot_sources, find sources, pick_sources) --> get_sources so
>>> in depth sort_sources does the default ordering job. get sources gets the
>>> sources (calling sort_sources, internal scoring) and find_sources gets
>>> scores based on comparison with a target vector (external scoring). How to
>>> unify this?
>> if target is None then the score_func expects only the sources and if not
>> None it is passed as second argument to the score_func. order =
>
> We could do this behaviour for find_sources where score_func could
> either be of x-arg or x-y-arg type.
>
>> ica.argsort_sources_epochs(epochs, …) ica.plot_sources_epochs(epochs, …)
>
> The we could replace sort_sources by find_sources but keep the
> implemented sorting bookkeeping.
> Let me think about it for a moment. Also getting back to you later :)
>
>
>>> I'm a bit -1 for adding more accessing-methods, It would get confusing at
>>> some point. But extending / altering functionality and / or renaming would
>>> be fine. The candidate I see is sort_sources We could try to merge
>>> sort_sources into find_sources or allow it to return scores and make it a
>>> internal-score version (index based on one input vecor) of find_sources or
>>> something like that. Then the top level functions could access both scoring
>>> functions via keys or so. However I'm a bit afraid of fumbling around with
>>> it. The whole picking depends on consistent sorting which took some time.
>> Basically you have to make sure, that pick_sources draws the sources in the
>> same order as your decision-maker (human, correlation-algorithm via
>> find_sources/ get_sources /sort_sources) If you see a quick way +1 for this.
>>> What do you think?
>> I am not sure. I'll get back to you later.
>
>>
>> —
>> Reply to this email directly or view it on GitHub.