RE: Extract the space group generators from Bilbao Crystallographic Server.

2022-07-14 Thread avi.e.gross
I guess Dan, that he may not be seeing what he is working on as a list of
lists of lists  with each terminal sublist being of cardinality 4. Maybe
Zhao could look up what methods a list object has that allow you to place
additional items, such as a list of 4 numbers, at the beginning or end or in
middle and select a method that does what he wants.

But I have to ask where exactly he wants to place this: "[0, 0, 0, 1]"

Unfortunately, we got no before and after picture, just after.  I will
explain what that means at the end but for now, I am making believe what you
show is the before and see what that would mean.

The list seems to be a representation for a  matrix that is 8 by 4 by 4.
Where do you place just the foursome above just once without breaking the
matrix? I mean you can extend it at the bottom by adding four of the above
as in 
[ [0, 0, 0, 1],
  [0, 0, 0, 1],
  [0, 0, 0, 1],
  [0, 0, 0, 1] ]

Or you can take each internal four partner like the first one:

[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]]

And extend each one at the right end by adding a fifth:

[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1], [0, 0, 0, 1]]

I can think of other transformations albeit I have no idea why this is being
done and what makes sense.

So first he needs to be clear on where and what he is adding and then think
of a method.

And BTW, this problem may also be looked at under a transformation. If
allowed to use some modules, it might make sense to feed the data structure
into something that returns a 3-D matrix directly and then use methods that
allow you to tack on parts of other matrices of various dimensions including
one. You can then flip it back into nested list format, if you wish.

OK, as mentioned earlier, if this is the AFTER then I have to look and see
if it is obvious where the "[0, 0, 0, 1]" was placed to make this:

[[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]],
 [[-1, 0, 0, 1], [0,-1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1]],
 [[-1, 0, 0, 1/2], [0, 1, 0, 1/2], [0, 0,-1, 1], [0, 0, 0, 1]],
 [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]],
 [[0, 1, 0, 3/4], [1, 0, 0, 1/4], [0, 0, -1, 3/4], [0, 0, 0, 1]],
 [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]],
 [[1, 0, 0,  0], [0, 1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1 ]],
 [[1, 0, 0, 1/2], [0, 1, 0, 0], [0, 0, 1, 1/2], [0, 0, 0, 1]]]

It looks like you are adding not once copy but eight copies with one each at
the end of the lists within the main list.

That makes this easy enough so think about what it means to deal with lists
and NOT matrices.

Your top list contains what I will call an a,b,c,d,e,f,g,h so if you wrote
code like

Mylist = [ "a", "b", ..., "g", "h"]

Then you can use a loop to iterate over those or perhaps a construct like
this:

[ item for item in Mylist ]

Wil gather them together and place them back in a list, which is useless but
it could be something applied to item like changing to upper case. In your
case, each item will be something like this:

[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0]]

And you want to extend it by attaching this [0, 0, 0, 1]

So how do you attach something to a list? Whatever that method is, call it
append and look it up and consider a line of code like:

[ item.append(something)  for item in Mylist ]

If done right, the above list comprehension loops over one dimension of your
list version of a matrix and adds [0, 0, 0, 1] to the end and then
eventually put the a/b/d/..h components back together to look like what I
THINK you are asking.

You can make some of the other possible changes using other tricks and
gimmicks like a nested comprehension but at some point, if you work well
with matrices, you may be better off converting your nested list into a
numpy matrix and make your addition another matrix and then use
numpy.concatenate, numpy.vstack and numpy.hstack  with proper care with
multiple dimensions to specify what axis they will combine on.

But doing the full (home)work for you is ...

-Original Message-
From: Python-list  On
Behalf Of Dan Stromberg
Sent: Thursday, July 14, 2022 10:07 PM
To: hongy...@gmail.com 
Cc: Python List 
Subject: Re: Extract the space group generators from Bilbao Crystallographic
Server.

It's good to include what you want to see as output, but it's important to
also include what you have as input.

It's also good to include what you've coded so far. It's considered good
etiquette to give it a try yourself before asking the list.

On Thu, Jul 14, 2022 at 1:03 PM hongy...@gmail.com 
wrote:

> I'm trying to extract the matrix data of "ITA-Setting F d -3 m [origin 1]"
> listed here [1], and then building an augmented matrix for each of 
> them by adding the last row as "[0, 0, 0, 1]". In short, the following 
> form is the ultimate-desired  result:
>
> [[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]],
>[[-1, 0, 0, 1], [0,-1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1]],
>[[-1, 0, 0, 1/2], [0, 1, 0, 1/2], [0, 0,-1, 

Re: Extract the space group generators from Bilbao Crystallographic Server.

2022-07-14 Thread Dan Stromberg
It's good to include what you want to see as output, but it's important to
also include what you have as input.

It's also good to include what you've coded so far. It's considered good
etiquette to give it a try yourself before asking the list.

On Thu, Jul 14, 2022 at 1:03 PM hongy...@gmail.com 
wrote:

> I'm trying to extract the matrix data of "ITA-Setting F d -3 m [origin 1]"
> listed here [1], and then building an augmented matrix for each of them by
> adding the last row as "[0, 0, 0, 1]". In short, the following form is the
> ultimate-desired  result:
>
> [[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]],
>[[-1, 0, 0, 1], [0,-1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1]],
>[[-1, 0, 0, 1/2], [0, 1, 0, 1/2], [0, 0,-1, 1], [0, 0, 0, 1]],
>[[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]],
>[[0, 1, 0, 3/4], [1, 0, 0, 1/4], [0, 0, -1, 3/4], [0, 0, 0, 1]],
>[[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]],
>[[1, 0, 0,  0], [0, 1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1 ]],
>[[1, 0, 0, 1/2], [0, 1, 0, 0], [0, 0, 1, 1/2], [0, 0, 0, 1]]]
>
> Any hints/tips/tricks for achieving this aim will be appreciated.
>
> [1]
> https://www.cryst.ehu.es/cgi-bin/cryst/programs//nph-trgen?gnum=227=gen=a-1/8,b-1/8,c-1/8=F%20d%20-3%20m%20:1=ita
>
> Regards,
> Zhao
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: ml on medical images - keras

2022-07-14 Thread avi.e.gross
Nati,

You ask what the problem is in that code. I say there I absolutely NO PROBLEM 
for me in that code.

Do you know why?

Because even if I want to copy it and make sure I have all the modules it 
needs, I have no access to the files it opens, and no idea what the output of 
the images pumped in is supposed to be and so on.

So since I won't try it, it stops being my problem.

Now if you want to know if someone spied any obvious error in the code, who 
knows, someone might. 

But guess who has access to all the code and files and anything else in your 
environment? You!

So why not use your interactive python interpreter and pause between parts of 
the code and insert requests to see what things look like, which is what 
programmers have been doing for decades, or use some debugger?

Check what is being done and if something fails, trace back as to what it was 
being given and see if that is what the manual page suggests you should be 
giving it and so on.

You cannot expect multiple people to keep doing the work for you and especially 
if they keep telling you they need more info.

I know very little about you and what tasks you have agreed to do but suggest 
that it may end up being a lot more work than you anticipated given how many 
kinds of pseudo-questions you seem to have.

What is wrong with your code is that someone else did not write it specifically 
for the purpose you want. My guess is that you copy lots of code from libraries 
or the internet and want to adapt it without necessarily understanding if it 
fits your needs or where it needs to be tweaked.

If I am wrong, I apologize. But if you want help here, or in other forums, 
consider changing your approach and consider what you would want if anyone else 
asked you to help them.

What you keep not wanting to do is supply a fairly simple example of inputs and 
outputs and error messages. Now in this case, if your inputs are images and 
machine learning algorithms are going to  output best guesses about features 
such as what animal is in the picture, it may indeed be harder to give serious 
details. 

When I see a question I can answer, I may chime in but for now, this process is 
too frustrating.

Avi

-Original Message-
From: Python-list  On 
Behalf Of ??? 
Sent: Monday, July 11, 2022 3:26 AM
To: python-list@python.org
Subject: Fwd: ml on medical images - keras

-- Forwarded message -
מאת: נתי שטרן 
‪Date: יום א׳, 10 ביולי 2022, 13:01‬
Subject: Re: ml on medical images - keras
To: Neuroimaging analysis in Python 


p.s. all the pictures are in PNG FORMAT

‫בתאריך יום א׳, 10 ביולי 2022 ב-13:01 מאת נתי שטרן <‪nsh...@gmail.com‬‏>:‬

> What's the problem on this code:
>
> import os
> from pickletools import float8, uint8
> from PIL import Image
>
> import numpy as np
> import tensorflow as tf
> from tensorflow import keras
> from tensorflow.keras import layers
> inputs=[]
> for i in os.listdir("c:/inetpub/wwwroot/out"):
> for j in os.listdir("c:/inetpub/wwwroot/out/"+i+"/"):
> A=Image.open("c:/inetpub/wwwroot/out/"+i+"/"+j)
> from matplotlib import pyplot as plt
>
> filename = 'image-test'
>
>
>   #  img = ( filename + '.png' )
> x=np.array(A,dtype=np.shape(A))
> inputs.append(x)
>
> simple_rnn = tf.keras.layers.SimpleRNN(4) #np.int output = 
> simple_rnn(inputs=np.array(inputs,dtype=np.ndarray(260, 730, 4)))  # 
> The output has shape `[32, 4]`.
>
> simple_rnn = tf.keras.layers.SimpleRNN(
> 4, return_sequences=True, return_state=True)
>
> # whole_sequence_output has shape `[32, 10, 4]`.
> # final_state has shape `[32, 4]`.
> whole_sequence_output, final_state = simple_rnn(inputs)
>
> --
> 
>


--

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

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


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

2022-07-14 Thread avi.e.gross
Dennis,

I see Nati sent some more code without explaining again what he wants. Yes, 
somewhere in this stack of messages he may have said things (that we generally 
failed to understand) but it would be helpful to summarize WHY he sent us what 
he did or which lines to look at.

 If your suggestion is right, he may not understand dictionaries as a hashed 
data structure where you can access a.items() or a.keys() or a.values() if you 
want a list of sorts of the parts, or a[key] if you want a particular part.

So do you think by b he means the names, meaning keys, so b=a.keys() might be 
what he wants?

I am asking YOU, because I have a 99% better chance of getting a good answer 
from you since you know about as much as I do about his project, than from Nati 
who needs to learn how to ask a question in a way that others can zoom in on 
and answer.

By now it is getting clear that he is working on a massive project and as he 
goes along, he gets stuck and the first reaction is to ask HERE. I think many 
of us are happy to chip in here and there but if it becomes a full-time job, 
would like to get paid! 

Avi

-Original Message-
From: Python-list  On 
Behalf Of Dennis Lee Bieber
Sent: Thursday, July 14, 2022 11:47 AM
To: python-list@python.org
Subject: Re: [Neuroimaging] what's the problem??

On Thu, 14 Jul 2022 08:49:39 +0300, ???   declaimed the 
following:

>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"]
>
Dicts don't have "indexes", they have "keys" (index implies a 
positional look-up: first, second, ..., tenth item).

Show us an example of your actual data, what it looks like in Python, 
and (hand-edited) what your really want the data to look like.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
--
https://mail.python.org/mailman/listinfo/python-list

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


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

2022-07-14 Thread avi.e.gross
That is more detailed, Nati, albeit I may not still understand.

 

You are working on a detailed project you may have some understanding of and 
getting stuck. But the people you ask for help do not have your info and, 
worse, your code seems full of blunders based on making assumptions, so reading 
it can give us a headache when we still have no idea what you want to do and 
what you want to do it to.

 

So let me make sure what I think you said and am replying to, is what you want. 
My guess is not.

 

It sounds like you already have a dictionary of size N that you read in from a 
file I have no access to and cannot see the contents but presumably contains 
two columns that can be converted into dictionary format. 

 

My first guess was you had another list of something also of length N stored in 
Difumo_names and wanted to substitute those new keys for the old ones. If the 
two are of the same length that should be doable, albeit older versions of 
dictionaries in Python did not guarantee the order of the contents. But reading 
the old code and your new stuff together does not lead me to assume this is the 
scenario. Your English may not be up to explaining as your short phrases seem 
to not mean what we expect.

 

Your code shown (way below) does not explain what "Difumo_names" used in quotes 
means but your code suggests it is meant as a SINGLE key as you use it like

 

b=a["Difumo_names"]

 

But is there any guarantee the dictionary has anything with that key? You may 
want to use a form that fails better such as:

 

b=a.get("Difumo_names"],-1)

 

That fails by assigning whatever default you replace “-1” with.

 

Just BTW, it might be a good idea to use names longer and more meaningful than 
“a” and “b” as following your code is harder when I have no idea what anything 
is about or for.

 

I, however, think your use of “b” later in your code makes no sense with this 
interpretation. What is stored in b if done as above is the arbitrary value in 
a[("Difumo_names"] which could be many things, including a list, but your code 
never explains what it is. So later you never use b in the code shown but 
several times use the construct below.

 

As part of a function call, one argument is:

 

labels=list(a["Difumo_names"].values())

 

The above SUGGESTS that you have a dictionary in a dictionary. Meaning, the 
dictionary called “a” has a key/value pair with the key being "Difumo_names"]” 
and the value being another dictionary that you can ask for the values alone 
and then combine them into a list.

 

But is this true? You need to know and explain what your dictionary contains 
and whether labels.to_dict() properly is able to read in a CSV and not only 
make a dictionary from it but make some of the values into sub-dictionaries. If 
not, you might need a better way to make your data structure.

 

Now, IF (and I am beyond guessing at this point) there is supposed to be a data 
structure in the value at a["Difumo_names"] that you want to be a dictionary, 
but it is now stored as something like a character string, then you need to 
find a way to convert it to a dictionary before using it like a dictionary.

 

I end by saying I have no clear idea what you want and expect at each step in 
your program. My suggestion is you rewrite your code to carefully print out 
info as it goes along and verify if what you are seeing makes sense at every 
step. Specifically, see what all the keys an values in “a” are. And at the 
REPL, play around and try typing in some code and see if it fails and what 
error messages you see. If some of your assumptions are wrong, they need fixing 
in that place and not by asking mysterious questions here from people who 
cannot see most of the picture.

 

 

 

 

From: נתי שטרן  
Sent: Thursday, July 14, 2022 1:50 AM
To: avi.e.gr...@gmail.com; python-list@python.org; Neuroimaging analysis in 
Python 
Subject: Re: [Neuroimaging] what's the problem??

 

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 

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

2022-07-14 Thread avi.e.gross

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 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()),
>>>

Extract the space group generators from Bilbao Crystallographic Server.

2022-07-14 Thread hongy...@gmail.com
I'm trying to extract the matrix data of "ITA-Setting F d -3 m [origin 1]" 
listed here [1], and then building an augmented matrix for each of them by 
adding the last row as "[0, 0, 0, 1]". In short, the following form is the 
ultimate-desired  result:

[[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0,1, 0], [0, 0, 0, 1]], 
   [[-1, 0, 0, 1], [0,-1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1]],
   [[-1, 0, 0, 1/2], [0, 1, 0, 1/2], [0, 0,-1, 1], [0, 0, 0, 1]],
   [[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]],
   [[0, 1, 0, 3/4], [1, 0, 0, 1/4], [0, 0, -1, 3/4], [0, 0, 0, 1]],
   [[-1, 0, 0, 1/4], [0, -1, 0, 1/4], [0, 0, -1, 1/4], [0, 0, 0, 1]],
   [[1, 0, 0,  0], [0, 1, 0, 1/2], [0, 0, 1, 1/2], [0, 0, 0, 1 ]],
   [[1, 0, 0, 1/2], [0, 1, 0, 0], [0, 0, 1, 1/2], [0, 0, 0, 1]]]

Any hints/tips/tricks for achieving this aim will be appreciated.

[1] 
https://www.cryst.ehu.es/cgi-bin/cryst/programs//nph-trgen?gnum=227=gen=a-1/8,b-1/8,c-1/8=F%20d%20-3%20m%20:1=ita

Regards,
Zhao
-- 
https://mail.python.org/mailman/listinfo/python-list


what's the problem??????

2022-07-14 Thread נתי שטרן
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: [Neuroimaging] what's the problem??????

2022-07-14 Thread Dennis Lee Bieber
On Thu, 14 Jul 2022 08:49:39 +0300, ???   declaimed
the following:

>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"]
>
Dicts don't have "indexes", they have "keys" (index implies a
positional look-up: first, second, ..., tenth item).

Show us an example of your actual data, what it looks like in Python,
and (hand-edited) what your really want the data to look like.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: ml on medical images - keras

2022-07-14 Thread נתי שטרן
-- Forwarded message -
מאת: נתי שטרן 
‪Date: יום א׳, 10 ביולי 2022, 13:01‬
Subject: Re: ml on medical images - keras
To: Neuroimaging analysis in Python 


p.s. all the pictures are in PNG FORMAT

‫בתאריך יום א׳, 10 ביולי 2022 ב-13:01 מאת נתי שטרן <‪nsh...@gmail.com‬‏>:‬

> What's the problem on this code:
>
> import os
> from pickletools import float8, uint8
> from PIL import Image
>
> import numpy as np
> import tensorflow as tf
> from tensorflow import keras
> from tensorflow.keras import layers
> inputs=[]
> for i in os.listdir("c:/inetpub/wwwroot/out"):
> for j in os.listdir("c:/inetpub/wwwroot/out/"+i+"/"):
> A=Image.open("c:/inetpub/wwwroot/out/"+i+"/"+j)
> from matplotlib import pyplot as plt
>
> filename = 'image-test'
>
>
>   #  img = ( filename + '.png' )
> x=np.array(A,dtype=np.shape(A))
> inputs.append(x)
>
> simple_rnn = tf.keras.layers.SimpleRNN(4)
> #np.int
> output = simple_rnn(inputs=np.array(inputs,dtype=np.ndarray(260, 730, 4)))
>  # The output has shape `[32, 4]`.
>
> simple_rnn = tf.keras.layers.SimpleRNN(
> 4, return_sequences=True, return_state=True)
>
> # whole_sequence_output has shape `[32, 10, 4]`.
> # final_state has shape `[32, 4]`.
> whole_sequence_output, final_state = simple_rnn(inputs)
>
> --
> 
>


-- 

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


message

2022-07-14 Thread Bart Kuijer via Python-list
In the last 10 years of my working life I worked as a freelancer, as a 
specialist in Microsoft Access, at Interpolis-Tilburg, Rabobank-Zeist, 
Abn-Amro-Amsterdam and the SVB in Amstelveen, among others.


From 1999 onward, I developed an accounting program in Microsoft Access 
for myself, Boeket, intended for Bakker-Schmalenbach's current chart of 
accounts in the Netherlands.
I am now 84 years old, I had a stroke 4 years ago and am paralyzed on 
the right side, in a wheelchair and have decided to port this package to 
Python


Can you help me with that?

I think there will be a working group with the aim of making the package 
available for free.

To get an idea what this is all about
1. the help screen https://app.box.com/s/fiy20u5r89n4jpn0346bnxu9xq6s86lk
2, the total package https://app.box.com/s/aag348tejxgdacc00n5ri3l9txa5bwwn

I am looking forward to your response.

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


Re: calculate diff between dates

2022-07-14 Thread Michael F. Stemper

On 12/07/2022 07.37, נתי שטרן wrote:

[snip ugly code that I'm not going to try to understand]



I glad for any help


There wasn't any question in your post. However, I'm going to
guess that there was the implied question of "How does one
find the difference between two dates?"


 >>> import datetime
 >>> d1 = datetime.date(2022,1,1)
 >>> d2 = datetime.date(2022,7,12)
 >>> d2-d1
 datetime.timedelta(192)
 >>>


--
Michael F. Stemper
If it isn't running programs and it isn't fusing atoms, it's just bending space.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Job vacancies

2022-07-14 Thread Dennis Lee Bieber
On Sun, 10 Jul 2022 18:46:26 +0300, Walid AlMasri 
declaimed the following:

>
>I  would like to ask if there are any openings that suit my background?
>I want to work on python either remotely or at job site

Most of the regulars here are just users asking for help with the
language, or providing said help. Some may be developers of the Python
language itself.

Pretty much none that I've seen have any inputs with the hiring
departments of any firms.

Very few firms look explicitly for Python, in my experience. They want
software engineers with experience in multiple languages and operating
systems, and skill in developing software independent of language -- the
language used comes down to implementation (give the design to some
new-hire to hack into working code  ) and may be constrained by the
application domain requirements (you won't find Python in real-time
avionics, for example -- but it might be used to analyze debug logs during
development of said avionics).

Your background appears to be research-biased, and Python (with
numpy/scipy/pandas) would just be a tool for analysis... as would R,
Octave, Matlab, Mathematica. Again, I wouldn't expect any such research
facility to mandate Python -- they'd be more interested in the "theoretical
physics" side and data collection. Analysis would come down to whatever
tool is best suited (likely by a team consensus).

>
>I attach my CV
>

NO binary attachments on this forum. Plain text may make it through
(since you could just include it as the message itself).

But... since no hiring manager is reading here, there is no reason to
include it. You need to investigate sites that manage job postings.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] ANN: distlib 0.3.5 released on PyPI

2022-07-14 Thread Vinay Sajip via Python-announce-list
I've recently released version 0.3.5 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

* Fixed #161: Updated test case.

* Fixed #164: Improved support for reproducible builds by allowing a fixed
  date/time to be inserted into created .exe files. Thanks to Somber Night for 
the
  patch.

* Fixed #169: Removed usage of deprecated imp module in favour of importlib.

* Fixed #170: Corrected implementation of ``get_required_dists()``.

* Fixed #172: Compute ABI correctly for Python < 3.8.

* Changed the default locator configuration.

* Made updates in support of PEP 643 / Metadata 2.2.

* Updated launcher executables. Thanks to Michael Bikovitsky for his help with
  the launcher changes.

* Updated to write archive path of RECORD to RECORD instead of staging path.
  Thanks to Pieter Pas for the patch.

A more detailed change log is available at [2].

Please try it out, and if you find any problems or have any suggestions for 
improvements,
please give some feedback using the issue tracker! [3]

Regards,

Vinay Sajip

[1] https://pypi.org/project/distlib/0.3.5/
[2] https://distlib.readthedocs.io/en/0.3.5/
[3] https://github.com/pypa/distlib/issues/new/choose

___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


ANN: distlib 0.3.5 released on PyPI

2022-07-14 Thread Vinay Sajip via Python-list
I've recently released version 0.3.5 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

* Fixed #161: Updated test case.

* Fixed #164: Improved support for reproducible builds by allowing a fixed
  date/time to be inserted into created .exe files. Thanks to Somber Night for 
the
  patch.

* Fixed #169: Removed usage of deprecated imp module in favour of importlib.

* Fixed #170: Corrected implementation of ``get_required_dists()``.

* Fixed #172: Compute ABI correctly for Python < 3.8.

* Changed the default locator configuration.

* Made updates in support of PEP 643 / Metadata 2.2.

* Updated launcher executables. Thanks to Michael Bikovitsky for his help with
  the launcher changes.

* Updated to write archive path of RECORD to RECORD instead of staging path.
  Thanks to Pieter Pas for the patch.

A more detailed change log is available at [2].

Please try it out, and if you find any problems or have any suggestions for 
improvements,
please give some feedback using the issue tracker! [3]

Regards,

Vinay Sajip

[1] https://pypi.org/project/distlib/0.3.5/
[2] https://distlib.readthedocs.io/en/0.3.5/
[3] https://github.com/pypa/distlib/issues/new/choose

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