Re: calculate diff between dates

2022-07-13 Thread Roel Schroeven

Op 12/07/2022 om 14:37 schreef נתי שטרן:

I glad for any help

http://www.catb.org/~esr/faqs/smart-questions.html

--
"Binnen een begrensde ruimte ligt een kritiek punt, waar voorbij de vrijheid
afneemt naarmate het aantal individuen stijgt. Dit gaat evenzeer op voor mensen
in de begrensde ruimte van een planetair ecosysteem, als voor de gasmoleculen
in een hermetisch gesloten vat. Bij mensen is het niet de vraag hoeveel er
maximaal in leven kunnen blijven in het systeem, maar wat voor soort bestaan
mogelijk is voor diegenen die in leven blijven.
  -- Pardot Kynes, eerste planetoloog van Arrakis"
  -- Frank Herbert, Duin

--
https://mail.python.org/mailman/listinfo/python-list


Re: what's the problem??????

2022-07-13 Thread נתי שטרן
I want to set dict

בתאריך יום ד׳, 13 ביולי 2022, 20:47, מאת נתי שטרן ‏:

> CODE:
>
> for nii in os.listdir("c:/users/administrator/desktop/nii"):
>
> from nilearn import plotting
> from nilearn import datasets
> atlas = datasets.fetch_atlas_msdl()
> # Loading atlas image stored in 'maps'
> atlas_filename =
> "C:/Users/Administrator/Desktop/64/64/2mm/maps.nii.gz"
> # Loading atlas data stored in 'labels'
> labels = pd.read_csv(
> "C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
> a=labels.to_dict()
> b=a["Difumo_names"]
> from nilearn.maskers import NiftiMapsMasker
> masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
> memory='nilearn_cache', verbose=5)
>
> time_series = masker.fit_transform(
> "c:/users/administrator/desktop/nii/"+nii)
> try:
> from sklearn.covariance import GraphicalLassoCV
> except ImportError:
> # for Scitkit-Learn < v0.20.0
> from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
>
> estimator = GraphicalLassoCV()
> estimator.fit(time_series)
> # Display the covariancec
> aas={}
> jsa=0
> for i in estimator.covariance_:
> r=list(a["Difumo_names"].values())[jsa]
> jsa=jsa+1
> a=dict()
>
>
> for x in range(64):
> g=list(a["Difumo_names"].values())[x]
>
> print(aas)
> t=   nilearn.plotting.plot_img(estimator.covariance_, labels=list(a[
> "Difumo_names"].values()),
> figure=(9, 7), vmax=1, vmin=-1,
> title='Covariance')# The covariance can be found
> at estimator.covariance_
>
> # The covariance can be found at estimator.covariance_
> t2=  nilearn.plotting.plot_matrix(estimator.covariance_, labels=list(a
> ["Difumo_names"].values()),
> figure=(9, 7), vmax=1, vmin=-1,
> title='Covariance')
>
>
>
> --
> 
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: what's the problem??????

2022-07-13 Thread Avi Gross via Python-list
Nati,
This is a two-way process and requires you to be very clear on what is not 
working or what you are trying to do or help clear away having us try to 
understand lots of code that is not very related to the question.
Your code, as shown, makes an empty string repeatedly in a loop. 
a=dict()
I am guessing the code there works fine and does nothing useful. Well, what do 
you want in your dictionary? Most people create a dictionary outside the loop 
as an empty dictionary and then in the loop use one of many methods to add 
key:value pairs.
Earlier in the code you had another line:
a=labels.to_dict()

If the labels variable had a method like that, that is also a way.
So be specific about what LINE or region of code and what is wrong and what you 
already tried or error messages you got.
Avi


-Original Message-
From: נתי שטרן 
To: Neuroimaging analysis in Python ; 
python-list@python.org
Sent: Wed, Jul 13, 2022 2:35 pm
Subject: Re: what's the problem??

I want to set dict

בתאריך יום ד׳, 13 ביולי 2022, 20:47, מאת נתי שטרן ‏:

> CODE:
>
> for nii in os.listdir("c:/users/administrator/desktop/nii"):
>
>    from nilearn import plotting
>    from nilearn import datasets
>    atlas = datasets.fetch_atlas_msdl()
>    # Loading atlas image stored in 'maps'
>    atlas_filename =
> "C:/Users/Administrator/Desktop/64/64/2mm/maps.nii.gz"
>    # Loading atlas data stored in 'labels'
>    labels = pd.read_csv(
> "C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
>    a=labels.to_dict()
>    b=a["Difumo_names"]
>    from nilearn.maskers import NiftiMapsMasker
>    masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
>                            memory='nilearn_cache', verbose=5)
>
>    time_series = masker.fit_transform(
> "c:/users/administrator/desktop/nii/"+nii)
>    try:
>        from sklearn.covariance import GraphicalLassoCV
>    except ImportError:
>        # for Scitkit-Learn < v0.20.0
>        from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
>
>    estimator = GraphicalLassoCV()
>    estimator.fit(time_series)
> # Display the covariancec
>    aas={}
>    jsa=0
>    for i in estimator.covariance_:
>        r=list(a["Difumo_names"].values())[jsa]
>        jsa=jsa+1
>        a=dict()
>
>
>        for x in range(64):
>            g=list(a["Difumo_names"].values())[x]
>
>    print(aas)
>    t=  nilearn.plotting.plot_img(estimator.covariance_, labels=list(a[
> "Difumo_names"].values()),
>                        figure=(9, 7), vmax=1, vmin=-1,
>                        title='Covariance')# The covariance can be found
> at estimator.covariance_
>
> # The covariance can be found at estimator.covariance_
>    t2=  nilearn.plotting.plot_matrix(estimator.covariance_, labels=list(a
> ["Difumo_names"].values()),
>                        figure=(9, 7), vmax=1, vmin=-1,
>                        title='Covariance')
>
>
>
> --
> 
>
-- 
https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Neuroimaging] what's the problem??????

2022-07-13 Thread נתי שטרן
I want to swap indexes of dict

בתאריך יום ד׳, 13 ביולי 2022, 21:51, מאת David Welch ‏<
david.m.we...@gmail.com>:

>
>>- Describe the research *you did* to try and understand the problem
>>*before* you asked the question.
>>- Describe the diagnostic steps *you took* to try and pin down the
>>problem yourself *before* you asked the question.
>>
>>
> On Wed, Jul 13, 2022 at 1:47 PM David Welch 
> wrote:
>
>> From http://catb.org/~esr/faqs/smart-questions.html#beprecise:
>>
>>> Be precise and informative about your problem
>>>
>>>-
>>>
>>>Describe the symptoms of your problem or bug carefully and clearly.
>>>-
>>>
>>>Describe the environment in which it occurs (machine, OS,
>>>application, whatever). Provide your vendor's distribution and release
>>>level (e.g.: “Fedora Core 7”, “Slackware 9.1”, etc.).
>>>-
>>>
>>>Describe the research you did to try and understand the problem
>>>before you asked the question.
>>>-
>>>
>>>Describe the diagnostic steps you took to try and pin down the
>>>problem yourself before you asked the question.
>>>-
>>>
>>>Describe any possibly relevant recent changes in your computer or
>>>software configuration.
>>>-
>>>
>>>If at all possible, provide a way to *reproduce the problem in a
>>>controlled environment*.
>>>
>>> Do the best you can to anticipate the questions a hacker will ask, and
>>> answer them in advance in your request for help.
>>>
>>> Giving hackers the ability to reproduce the problem in a controlled
>>> environment is especially important if you are reporting something you
>>> think is a bug in code. When you do this, your odds of getting a useful
>>> answer and the speed with which you are likely to get that answer both
>>> improve tremendously.
>>>
>>> Simon Tatham has written an excellent essay entitled How to Report Bugs
>>> Effectively . I
>>> strongly recommend that you read it.
>>>
>>>
>>
>> -- Forwarded message -
>> From: נתי שטרן 
>> Date: Wed, Jul 13, 2022 at 1:36 PM
>> Subject: Re: [Neuroimaging] what's the problem??
>> To: Neuroimaging analysis in Python , <
>> python-list@python.org>
>>
>>
>> I want to set dict
>>
>> בתאריך יום ד׳, 13 ביולי 2022, 20:47, מאת נתי שטרן ‏:
>>
>>> CODE:
>>>
>>> for nii in os.listdir("c:/users/administrator/desktop/nii"):
>>>
>>> from nilearn import plotting
>>> from nilearn import datasets
>>> atlas = datasets.fetch_atlas_msdl()
>>> # Loading atlas image stored in 'maps'
>>> atlas_filename =
>>> "C:/Users/Administrator/Desktop/64/64/2mm/maps.nii.gz"
>>> # Loading atlas data stored in 'labels'
>>> labels = pd.read_csv(
>>> "C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
>>> a=labels.to_dict()
>>> b=a["Difumo_names"]
>>> from nilearn.maskers import NiftiMapsMasker
>>> masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
>>> memory='nilearn_cache', verbose=5)
>>>
>>> time_series = masker.fit_transform(
>>> "c:/users/administrator/desktop/nii/"+nii)
>>> try:
>>> from sklearn.covariance import GraphicalLassoCV
>>> except ImportError:
>>> # for Scitkit-Learn < v0.20.0
>>> from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
>>>
>>> estimator = GraphicalLassoCV()
>>> estimator.fit(time_series)
>>> # Display the covariancec
>>> aas={}
>>> jsa=0
>>> for i in estimator.covariance_:
>>> r=list(a["Difumo_names"].values())[jsa]
>>> jsa=jsa+1
>>> a=dict()
>>>
>>>
>>> for x in range(64):
>>> g=list(a["Difumo_names"].values())[x]
>>>
>>> print(aas)
>>> t=   nilearn.plotting.plot_img(estimator.covariance_, labels=list(a[
>>> "Difumo_names"].values()),
>>> figure=(9, 7), vmax=1, vmin=-1,
>>> title='Covariance')# The covariance can be
>>> found at estimator.covariance_
>>>
>>> # The covariance can be found at estimator.covariance_
>>> t2=  nilearn.plotting.plot_matrix(estimator.covariance_, labels=list
>>> (a["Difumo_names"].values()),
>>> figure=(9, 7), vmax=1, vmin=-1,
>>> title='Covariance')
>>>
>>>
>>>
>>> --
>>> 
>>>
>> ___
>> Neuroimaging mailing list
>> neuroimag...@python.org
>> https://mail.python.org/mailman/listinfo/neuroimaging
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Neuroimaging] what's the problem??????

2022-07-13 Thread נתי שטרן
Instead of numbers, I want to enter as indexes the names of the Index as
being in b variable:
 labels = pd.read_csv(
"C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
a=labels.to_dict()
b=a["Difumo_names"]

‫בתאריך יום ה׳, 14 ביולי 2022 ב-7:44 מאת <‪avi.e.gr...@gmail.com‬‏>:‬

> Nati,
>
> I know you think you are communicating.
>
> שטרן >> I want to swap indexes of dict
>
> When you say SWAP, do you mean replace the index with something else, or
> swap the key and value or something entirely else?
>
> You have not shared an example of what is in your dictionary, but say it
> is:
>
> myDict = {1:"a", 2:"b", 3:"c"}
>
> invDict = { value:key for key, value in myDict.items() }
>
> print(myDict)
> print(invDict)
>
>
> The above prints out:
>
> print(myDict)
> {1: 'a', 2: 'b', 3: 'c'}
>
> print(invDict)
> {'a': 1, 'b': 2, 'c': 3}
>
> It obviously generalizes only for dictionaries where all values are
> unique. And you can obviously save the results back into the same variable
> if you wish. The above comprehension may, of course, not be what you want
> as swapping indexes with  may not mean anything to us trying
> to help.
>
> Avi (a שטרן on my mother's side.)
>
>
> -Original Message-
> From: Python-list 
> On Behalf Of ??? 
> Sent: Thursday, July 14, 2022 12:19 AM
> To: David Welch ; Neuroimaging analysis in
> Python ; python-list@python.org
> Subject: Re: [Neuroimaging] what's the problem??
>
> I want to swap indexes of dict
>
> בתאריך יום ד׳, 13 ביולי 2022, 21:51, מאת David Welch ‏<
> david.m.we...@gmail.com>:
>
> >
> >>- Describe the research *you did* to try and understand the problem
> >>*before* you asked the question.
> >>- Describe the diagnostic steps *you took* to try and pin down the
> >>problem yourself *before* you asked the question.
> >>
> >>
> > On Wed, Jul 13, 2022 at 1:47 PM David Welch 
> > wrote:
> >
> >> From http://catb.org/~esr/faqs/smart-questions.html#beprecise:
> >>
> >>> Be precise and informative about your problem
> >>>
> >>>-
> >>>
> >>>Describe the symptoms of your problem or bug carefully and clearly.
> >>>-
> >>>
> >>>Describe the environment in which it occurs (machine, OS,
> >>>application, whatever). Provide your vendor's distribution and
> release
> >>>level (e.g.: “Fedora Core 7”, “Slackware 9.1”, etc.).
> >>>-
> >>>
> >>>Describe the research you did to try and understand the problem
> >>>before you asked the question.
> >>>-
> >>>
> >>>Describe the diagnostic steps you took to try and pin down the
> >>>problem yourself before you asked the question.
> >>>-
> >>>
> >>>Describe any possibly relevant recent changes in your computer or
> >>>software configuration.
> >>>-
> >>>
> >>>If at all possible, provide a way to *reproduce the problem in a
> >>>controlled environment*.
> >>>
> >>> Do the best you can to anticipate the questions a hacker will ask,
> >>> and answer them in advance in your request for help.
> >>>
> >>> Giving hackers the ability to reproduce the problem in a controlled
> >>> environment is especially important if you are reporting something
> >>> you think is a bug in code. When you do this, your odds of getting a
> >>> useful answer and the speed with which you are likely to get that
> >>> answer both improve tremendously.
> >>>
> >>> Simon Tatham has written an excellent essay entitled How to Report
> >>> Bugs Effectively
> >>> . I strongly
> recommend that you read it.
> >>>
> >>>
> >>
> >> -- Forwarded message -
> >> From: נתי שטרן 
> >> Date: Wed, Jul 13, 2022 at 1:36 PM
> >> Subject: Re: [Neuroimaging] what's the problem??
> >> To: Neuroimaging analysis in Python , <
> >> python-list@python.org>
> >>
> >>
> >> I want to set dict
> >>
> >> בתאריך יום ד׳, 13 ביולי 2022, 20:47, מאת נתי שטרן ‏:
> >>
> >>> CODE:
> >>>
> >>> for nii in os.listdir("c:/users/administrator/desktop/nii"):
> >>>
> >>> from nilearn import plotting
> >>> from nilearn import datasets
> >>> atlas = datasets.fetch_atlas_msdl()
> >>> # Loading atlas image stored in 'maps'
> >>> atlas_filename =
> >>> "C:/Users/Administrator/Desktop/64/64/2mm/maps.nii.gz"
> >>> # Loading atlas data stored in 'labels'
> >>> labels = pd.read_csv(
> >>> "C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
> >>> a=labels.to_dict()
> >>> b=a["Difumo_names"]
> >>> from nilearn.maskers import NiftiMapsMasker
> >>> masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
> >>> memory='nilearn_cache', verbose=5)
> >>>
> >>> time_series = masker.fit_transform(
> >>> "c:/users/administrator/desktop/nii/"+nii)
> >>> try:
> >>> from sklearn.covariance import GraphicalLassoCV
> >>> except ImportError:
> >>> # for Scitkit-Learn < v0.20.0
> >>> from sklearn.covariance import GraphLa