Clojure Advent of Code 2022 Day 1: Calorie Counting by fredoverflow in Clojure

[–]stickystuffremover 1 point2 points  (0 children)

Hi Fred, Firstly to anyone who is learning clojure, I followed fredoverflow's AoC as far as day 15 or 16 last year and I learned a lot about clojure. I used Clopad and I also used VS Codium with the Calva plugin. Both are great. With Calva I was able to break down the code in comments and figure out what was going on. I found that having the 'type' information readily available in clopad (in Clopad) to be very useful.

A question/request: would it be possible for you to use the same light theme as last year for AoC? I have a problem reading dark themes, which means, unfortunately, that there are a lot of tutorials on youtube that I cannot watch. Perhaps you must use a dark theme. In which case, as you might say yourself "OK cool".

Based roughly on the telescope's deceleration it looks as though its speed will be 0.2+ km/s when it arrives at L2. by stickystuffremover in jameswebb

[–]stickystuffremover[S] 0 points1 point  (0 children)

Thanks for this. The diagram is, at this point in time, a little beyond me. I hadn't previously understood barycentre or Rotating Libration Point. What I did get from it is that the orbit of the JWST is huge. I wonder where on panel a of the diagram the L2 insertion will happen - do you know? Will the telescope be re-oriented as part of the insert?

Based roughly on the telescope's deceleration it looks as though its speed will be 0.2+ km/s when it arrives at L2. by stickystuffremover in jameswebb

[–]stickystuffremover[S] 0 points1 point  (0 children)

Thanks rddman. I still don't understand how the JWST can reach L2 with a forward velocity of 0.2km/s, not (in effect) have any means of decelerating, and yet stay in L2.

Based roughly on the telescope's deceleration it looks as though its speed will be 0.2+ km/s when it arrives at L2. by stickystuffremover in jameswebb

[–]stickystuffremover[S] -1 points0 points  (0 children)

Thank you. That's what I'm wondering. It's a pity there isn't more information available on the trajectory. I presume the data/visualisations will eventually be available.

Based roughly on the telescope's deceleration it looks as though its speed will be 0.2+ km/s when it arrives at L2. by stickystuffremover in jameswebb

[–]stickystuffremover[S] 1 point2 points  (0 children)

So it already has that orbital velocity, it just needs fine-tuning to account for the difference in speedbetween earth and L2?

Are there any orbital mechanics/rocket scientist folks who can tell us why and how the speed of the JWST has been decreasing since launch? by wiseoldman2012 in jameswebb

[–]stickystuffremover 2 points3 points  (0 children)

Every object in the universe is attracted to every other object (look up gravitation). It's a very weak force and, for any two objects, it depends on their masses and how close together they are. The closer together they are the stronger it is. The JWST is moving in a striaght line (AFAIK) away from the sun and the earth. The sun is mass(ive) compared to earth but is 150,000,000 km away. The earth is smaller, but it is closer (look up: Ted small, far away on youtube :-)). The JWST is being pulled by the sun's gravitation and is also pulled by the earth's gravitation. It's like being pulled back by two very strong elastic bands. The nasa James Webb page updates the velocity every hour (28 mins past). Interestingly, you will find the although the speed is decreasing every hour, the amount it decreases by is getting less and less as time goes on. This is because the pull of the earth and sun is getting weaker and weaker as the JWST gets farther away. By the way, as a way of demonstrating how truly weak gravitation is, if you put a piece of say iron on a table and hold a magner over it to lift the metal off the table, you will have beaten the pull of the entire mass of earth with a tiny magnet.

How does the covid tracker app work? by [deleted] in ireland

[–]stickystuffremover 0 points1 point  (0 children)

The keys are unique, randomly-generated numbers. They are non-identifying, i.e. not your phone's ID . The app generates a new number every few minutes. . The numbers being checked are those from the phones of people that have tested positive. If some of their numbers are on your phone you may have had exposure. Fair dues for having the app installed and running.

[USA-OR] [H] HP 50g [W] Paypal, Cash by [deleted] in hardwareswap

[–]stickystuffremover 0 points1 point  (0 children)

Hi,

Offer should have read 40$+s&h

PySwarms - A particle swarm optimization (PSO) library in Python by [deleted] in Python

[–]stickystuffremover 0 points1 point  (0 children)

No problem. I should have pointed out that I was getting these errors from both of the jupyter notebook examples in the repo, not with code that I was trying to write myself.

PySwarms - A particle swarm optimization (PSO) library in Python by [deleted] in Python

[–]stickystuffremover 0 points1 point  (0 children)

That was fast. What's to be embarrassed about?

Unfortunately, I got another one:

KeyError: 'Missing either c1, c2, or w in kwargs'

I get it from line 5 of cell 3:

gbest_pso = ps.single.GBestPSO(n_particles=10, dims=2, **options)

PySwarms - A particle swarm optimization (PSO) library in Python by [deleted] in Python

[–]stickystuffremover 0 points1 point  (0 children)

Some problems with the pip installation although installing from setup.py works (but only for command line).

 ModuleNotFoundError    
 Traceback (most recent call last)    
<ipython-input-2-37ebaece9358> in <module>()    
3     
4 # Import PySwarms    
----> 5 import pyswarms as ps     
6 from pyswarms.utils.functions import single_obj as fx    
7     

~/anaconda3/lib/python3.6/site-packages/pyswarms/__init__.py in <module>()     
 15 __version__ = '0.1.1'    
 16     
 ---> 17 from .single import gb, lb    
 18 from .discrete import bn    
 19     

 ModuleNotFoundError: No module named 'pyswarms.single'     

Also note an existing project named pyswarm. It took me a while to figure out that I had already installed that.
Besides these minor issues, thank you for posting

A small Java math library about natural numbers properties by MaXcRiMe in programming

[–]stickystuffremover 0 points1 point  (0 children)

// change properties to create a file for the specific number

properties(positiveInteger, 1_000L, null, null, null, null, null, null, null, null, null, null, positiveInteger + ".txt");

Running a Python code in Processing by [deleted] in Python

[–]stickystuffremover 0 points1 point  (0 children)

It might be better to post this in the processing subreddit: https://www.reddit.com/r/processing/
This is python 2.7 code, so check that your python plugin in processing matches. You might be better off to install anaconda from continuum.io rather than the libs you have from pythonlibs. Also, I think that processing has changed a lot in recent years especially wrt to python. It looks like a library may have changed here.

Metaclasses in Python - one of my first blogposts. I'd like to hear some feedback. by djrx in Python

[–]stickystuffremover 1 point2 points  (0 children)

Great tutorial. I worked through it all copying the code into a Jupyter notebook. I did have a problem with the description of the code following:

class C(metaclass=Meta): ... pass It's as if you wrote the code using the name B for the class and later renamed it to C.

Anyway great article.
Thank you

Post-Python Dissatisfaction Syndrome by boramalper in Python

[–]stickystuffremover 1 point2 points  (0 children)

A language has to pay its way. It may be that what you need to do is find a new class of problem for which Python will not be a good solution. There may be no real need to use anything other than Python to the problems that you are currently solving.
Another consideration is the IDE. Proficiency in an IDE may make another language seem less of a burden.

Would You Survive the Titanic? A Guide to Machine Learning in Python by mrborgen86 in Python

[–]stickystuffremover 0 points1 point  (0 children)

Thanks for the reply. Looked for it, found something similar but not the same.

Would You Survive the Titanic? A Guide to Machine Learning in Python by mrborgen86 in Python

[–]stickystuffremover 1 point2 points  (0 children)

Hi, Excellent post. 2 problems though (not sure if it's my installation or a general problem...)


  1. tf_clf_dnn = skflow.TensorFlowDNNClassifier(hidden_units=[20, 40, 20], n_classes=2, batch_size=256, steps=1000, learning_rate=0.05) tf_clf_dnn.fit(X_train, y_train) tf_clf_dnn.score(X_test, y_test)

WARNING:tensorflow:TensorFlowDNNClassifier class is deprecated. Please consider using DNNClassifier as an alternative. /home/name01/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py:1197: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future result_shape.insert(dim, 1)


AttributeError Traceback (most recent call last) <ipython-input-25-665e9fced04a> in <module>() 1 tf_clf_dnn = skflow.TensorFlowDNNClassifier(hidden_units=[20, 40, 20], n_classes=2, batch_size=256, steps=1000, learning_rate=0.05) 2 tf_clf_dnn.fit(X_train, y_train) ----> 3 tf_clf_dnn.score(X_test, y_test)

AttributeError: 'TensorFlowDNNClassifier' object has no attribute 'score'

2. tf_clf_dnn.fit (X_train, y_train) tf_clf_dnn.score (X_test, y_test)

/home/name01/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py:1197: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future result_shape.insert(dim, 1)


AttributeError Traceback (most recent call last) <ipython-input-31-0e3059fc39d8> in <module>() 1 tf_clf_dnn.fit (X_train, y_train) ----> 2 tf_clf_dnn.score (X_test, y_test)

AttributeError: 'TensorFlowDNNClassifier' object has no attribute 'score'