Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Peace was the way. -- Kirk, "The City on the Edge of Forever", stardate unknown


devel / comp.lang.python / Fast help with Python program

SubjectAuthor
* Fast help with Python programArak Rachael
`- Re: Fast help with Python programDennis Lee Bieber

1
Fast help with Python program

<50370ea0-461a-4ee7-b3a7-35e9fa3cf11cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18760&group=comp.lang.python#18760

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a37:a154:: with SMTP id k81mr4507443qke.202.1627553450790;
Thu, 29 Jul 2021 03:10:50 -0700 (PDT)
X-Received: by 2002:a37:a5c9:: with SMTP id o192mr4407754qke.58.1627553450509;
Thu, 29 Jul 2021 03:10:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Thu, 29 Jul 2021 03:10:50 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=147.32.71.9; posting-account=JJGqywoAAAB2eLYtEcnciXguFNMM9YZi
NNTP-Posting-Host: 147.32.71.9
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <50370ea0-461a-4ee7-b3a7-35e9fa3cf11cn@googlegroups.com>
Subject: Fast help with Python program
From: arakelthedragon@gmail.com (Arak Rachael)
Injection-Date: Thu, 29 Jul 2021 10:10:50 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Arak Rachael - Thu, 29 Jul 2021 10:10 UTC

Hi guys,

I need fast help with this, can you please look at it?

I don't get how to visualize on the 3 axis in the for cycle with the list of colors and count of colors that I get from my array.

And I also don't get how to cluster the colors based on how many colors there are in the second array from get_unique_colors(img).

https://www.dropbox.com/s/ifvecwb5c0iy2pa/test_scripts.py?dl=0

Re: Fast help with Python program

<mailman.289.1627581691.4164.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18765&group=comp.lang.python#18765

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: wlfraed@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: Fast help with Python program
Date: Thu, 29 Jul 2021 11:19:17 -0400
Organization: IISS Elusive Unicorn
Lines: 71
Message-ID: <mailman.289.1627581691.4164.python-list@python.org>
References: <50370ea0-461a-4ee7-b3a7-35e9fa3cf11cn@googlegroups.com>
<kgf5gghloavrutarvo1l63plmb593qdvv4@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de ugAYzrWE8zVBZfv99UkATABrRumm11x7lfktxFIFovAg==
Return-Path: <python-python-list@m.gmane-mx.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'jul': 0.04; 'comment:':
0.05; 'row': 0.05; 'usage': 0.05; 'debug': 0.07; 'solving': 0.07;
'matrix': 0.09; 'point,': 0.09; 'received:ciao.gmane.io': 0.09;
'received:gmane.io': 0.09; 'received:list': 0.09;
'subject:Python': 0.12; '(1,': 0.16; '1),': 0.16; 'cluster': 0.16;
'clustering': 0.16; 'count.': 0.16; 'dummy': 0.16; 'generating':
0.16; 'message-id:@4ax.com': 0.16; 'particular.': 0.16;
'received:116.202': 0.16; 'received:116.202.254': 0.16;
'received:116.202.254.214': 0.16; 'scatter': 0.16; 'sounds': 0.16;
'subject:program': 0.16; 'times,': 0.16; 'tuples,': 0.16;
'value?': 0.16; 'thu,': 0.20; 'to:addr:python-list': 0.23;
'lines': 0.24; 'code': 0.24; 'help.': 0.24; '>>>': 0.26; 'seems':
0.26; 'space': 0.26; 'again,': 0.27; 'extract': 0.27; 'bit': 0.28;
'comment': 0.28; '(and': 0.30; 'header:User-Agent:1': 0.31;
'header:Organization:1': 0.31; 'there': 0.31; 'printed': 0.31;
'seem': 0.31; 'but': 0.31; "doesn't": 0.32; 'intend': 0.32;
'url:dropbox': 0.32; '100': 0.34; 'attempt': 0.34; 'count': 0.37;
'two': 0.37; 'change': 0.37; '(or': 0.37; 'those': 0.38; 'list':
0.39; 'entity': 0.40; 'subject:help': 0.40; 'could': 0.40;
'counts': 0.61; 'reference': 0.61; 'upon': 0.63; 'showing': 0.63;
'time.': 0.63; 'everything': 0.64; 'range': 0.64; 'your': 0.64;
'accept': 0.68; 'acknowledge': 0.69; 'scale': 0.69; 'shape': 0.69;
'received:116': 0.71; "you'll": 0.75; '....': 0.81; '2021': 0.84;
'cycles': 0.84; 'cycling': 0.84; 'url-ip:76/8': 0.84; 'colors':
0.91; 'thin': 0.91
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: YES
X-Mailman-Approved-At: Thu, 29 Jul 2021 14:01:30 -0400
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <kgf5gghloavrutarvo1l63plmb593qdvv4@4ax.com>
X-Mailman-Original-References: <50370ea0-461a-4ee7-b3a7-35e9fa3cf11cn@googlegroups.com>
 by: Dennis Lee Bieber - Thu, 29 Jul 2021 15:19 UTC

On Thu, 29 Jul 2021 03:10:50 -0700 (PDT), Arak Rachael
<arakelthedragon@gmail.com> declaimed the following:

>
>And I also don't get how to cluster the colors based on how many colors there are in the second array from get_unique_colors(img).
>
>https://www.dropbox.com/s/ifvecwb5c0iy2pa/test_scripts.py?dl=0

And just what have you tried? Showing us the "arrays"* as printed by
the debug lines in your code would perhaps help.

COMMENT:

Lines 40-50 are a bit of a mess...

Where is "n" defined in lines 46-48 (I acknowledge those are just dummy
lines in your attempt at solving this). For that loop, you are only
generating ONE data point, and then calling for a scatter plot of one value
-- then repeating for the next value (and there are only TWO cycles in the
loop, one for each marker).

The commented out lines (40-42) reference "color_list", but again,
there is no such entity in the previous lines. You are also cycling over
that (missing) list three times, just to extract one part at a time.
Consider:

>>> rgb = [ (1, 2, 3),
.... (3, 1, 1),
.... (4, 2, 3),
.... (2, 4, 1) ]
>>>
>>> rgb
[(1, 2, 3), (3, 1, 1), (4, 2, 3), (2, 4, 1)]
>>> rsgsbs = [t for t in zip(*rgb)]
>>> rsgsbs
[(1, 3, 4, 2), (2, 1, 2, 4), (3, 1, 3, 1)]
>>>

You now have a list of three tuples, one each for R, G, B

Since R/G/B already determine the location of a point in 3D space (I
presume 0..255 ranging, and not 0.0..1.0, just to avoid clustering
everything in a very thin layer of a 3D plot) -- what did you intend to do
with the "count" value? Change the marker based upon the count?
Unfortunately, the documentation doesn't seem to support a dynamic marker
shape (ie; accept a list of markers to be used). You CAN change the marker
SIZE (but you'll want to scale the counts as the size is points**2, count
of 1 would be 1 point, but a count of 10 would make a 100 point blot). You
could create a color map (cmap=) and provide the count list (c=), set norm=
to some subclass of Normalize (or normalize the range of count into
0.0..1.0 beforehand).

* Your usage of "array" seems rather ambiguous... The comment at line 43
is particular. It sounds to me that what you have is a matrix of 2xN
elements; one row having the RGB colors, the other row having the
corresponding count. If so...

colors = clist[0]
count = clist[1]
rgb = [t for t in zip(* colors)]
xs = rgb[0]
ys = rgb[1]
zs = rgb[2]

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/


devel / comp.lang.python / Fast help with Python program

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor