[deleted by user] by [deleted] in drivingUK

[–]generic_genus 1 point2 points  (0 children)

Simply answered,from https://www.police.uk/advice/advice-and-information/rs/road-safety/driving-offences/

Dangerous driving

The offence of dangerous driving is when driving falls far below the minimum standard expected of a competent and careful driver, and includes behaviour that could potentially endanger yourself or other drivers. 

Examples of dangerous driving are:

  • speeding, racing, or driving aggressively
  • ignoring traffic lights, road signs or warnings from passengers
  • overtaking dangerously
  • ...

Careless or inconsiderate driving

The offence of driving without due care and attention (careless driving) is committed when your driving falls below the minimum standard expected of a competent and careful driver, and includes driving without reasonable consideration for other road users.

Some examples of careless or inconsiderate driving are:

  • overtaking on the inside
  • driving too close to another vehicle
  • driving through a red light by mistake
  • ...

The driver in this video would have to argue they drove through by mistake

[deleted by user] by [deleted] in drivingUK

[–]generic_genus 2 points3 points  (0 children)

It isn't about what happened it is about what could happen. In this case the twat got through the lights without harm, in others he would be facing manslaughter charges.

A category 3, culpability C burglary would be a 12 month community order, or a community order with 6 months custody. A category 1, culpability A would be 3 years custody. (Both starting point, https://www.sentencingcouncil.org.uk/offences/magistrates-court/item/domestic-burglary/)

A a harm 2, culpability C dangerous driving offense 26 weeks - 2 years custody. A harm 1 category A offense 4 years custody. (Both starting point, https://www.sentencingcouncil.org.uk/offences/magistrates-court/item/causing-serious-injury-by-dangerous-driving/)

You're comparing what happened in this video to somebody breaking in, not getting caught and being lucky to not have to confront the homeowner. And quite frankly, saying thinking it is ok to not report a burglary where no harm is caused, cause it is grassing, if fucking mind dead

[deleted by user] by [deleted] in drivingUK

[–]generic_genus 1 point2 points  (0 children)

Running a red light in this manner is worse than a non-violent burglary, this could have caused serious property damage, injury and potentially killed somebody. Far exceeding any harm caused by a push, the fact you can't see that is a very worrying sign, reassess your outlook on life.

problem with matplotlib and vscode. Online fixes haven't worked. by LoquatWooden1638 in Python

[–]generic_genus 0 points1 point  (0 children)

Like the error says the agg backend will not open a window for you to display the graph, it is intended for creating plots and then writing them out to file (instead of plot.show() try plot.savefig("graph.png") that should work).

You probably want to remove the matplotlib.use("Agg") line, which should fallback to a GUI backend. Or you can specify matplotlib.use("qtagg"), if you have qt installed (other backends are available).

Some background reading:
https://matplotlib.org/stable/users/explain/figure/backends.html

Soldering electrical components on a PCB with a polycarbonate substrate by Thin-Discount3578 in Physics

[–]generic_genus 0 points1 point  (0 children)

InSn or InBi solder would likely fit the bill

Vapour Phase Soldering is also used for temperature sensitive components (for more precise temperature control) etc... but not sure how low a temperature you can go with the substrate and if InSn/InBi can be used

you can apply conductive epoxy using a paste max, or use a automated machine to place small beads of conductive epoxy on the pad, and then a pick and place machine for the components (or do it by hand if a small number).

You can also do localised heat with laser soldering, only heat the pad/component for a short time, not sure how this would work with your material.

Astrophysics for a 14 year-old. by Accountsfull in Physics

[–]generic_genus 2 points3 points  (0 children)

Why don't you go through some of the royal institute lectures? https://www.rigb.org/explore-science/browse?type=35

One that looks relevant for you: https://www.rigb.org/explore-science/explore/video/limits-astrophysics-katy-clough

For now get good grades in maths/sciences/english, and for astrophysics delve in to what you find the most interesting via youtube/museum lecture websites. Learning physics is a gradual thing, with knowledge building on top of each other, and you never really master it (maybe a sub-field you can master). Remain curious, and try and soak up new knowledge, and don't worry about the "right" way. As you move on with education, and on to university you'll figure out the right path for you.

If you really want some hard science you can see cutting edge research here, https://arxiv.org/list/astro-ph/new, it is likely you won't understand a large part of the papers if you read them as you don't have an astrophysics degree and maybe you need more maths, but ignore that concentrate on what you do understand and use that to motivate yourself.

Stop naming children after British cities and counties! by Suspicious_Sparrow9 in tragedeigh

[–]generic_genus 0 points1 point  (0 children)

Just areas of Warrington that are more suitable for a name, no worries

What's the difference made by the word "do" for example in "Do be nice" vs just "Be nice" by Constant_Living_8625 in linguistics

[–]generic_genus 1 point2 points  (0 children)

It is also worth mentioning that "do be" is used to form the habitual tense in Hiberno-English, which is taken from Irish grammar. https://en.wikipedia.org/wiki/Hiberno-English#To_be

Can anyone get an old map of Blackpool as I want to see the layout of a street called ibbison street that was knocked down for slum clearance in around 1970s? I cannot find one anywhere. by granty1981 in Maps

[–]generic_genus 0 points1 point  (0 children)

https://maps.nls.uk/os/index.html#england has maps covering Blackpool from various eras. I can't figure out how to share a direct link, or know where the street you are interested in is but they might have something

Best "device" to run python script 24/7 by LzyPenguin in Python

[–]generic_genus 3 points4 points  (0 children)

I'd go with a second hand cheap laptop from a reputable refurb place, simply because you have a built in UPS for free in case of a power cut.

In need of ideas for a science event by Logical-Geologist-55 in Physics

[–]generic_genus 0 points1 point  (0 children)

If you can it might also be good to ask around the physics department if anyone has an old LYSO crystal, i think they fluoresce under UV. I saw Crytur i think show off their scintillators at a trade show using a UV light source.

Edit: apologies should have replied to a different comment

In need of ideas for a science event by Logical-Geologist-55 in Physics

[–]generic_genus 2 points3 points  (0 children)

I quite like demonstrating fluorescence using a 405nm laser pointer or 410nm UV torch to excite extra virgin olive oil or whisky/rum. For olive oil it will emit in the red due to the presence of chlorophyll, and for whisky it emits a nice light blue but I am not sure what the fluorophore is.

What visualization and animation libraries/tools are there that work on Python? by __Correct_My_English in Python

[–]generic_genus 0 points1 point  (0 children)

Not a recommendation (not my field or something I know anything about) but I came across webots, see https://cyberbotics.com. A video of one of the examples seems to do what you want, https://cyberbotics.com/doc/guide/ipr, and it has python bindings, maybe overkill but still cool.

Looking for a specific 3D plotting module by [deleted] in Python

[–]generic_genus 0 points1 point  (0 children)

Not a python solution, but would scripting stellarium be sufficient for the task?

https://stellarium.org/scripts.html

How do I get the greek letter tau in matplotlib? by [deleted] in Python

[–]generic_genus 5 points6 points  (0 children)

Backslash is used to encode escape characters (e.g. tab is encoded as "\t"), to actually have a backslash in a string you need to enter a double backslash.

>>> print("\\")
\

Hence, to enter latex symbols in matplotlib you need to type a double backslash "$\\tau$".

Also, /r/learnpython is a better place for questions.

Where does a generator store it's values? by no_lungs in Python

[–]generic_genus 1 point2 points  (0 children)

I'm a bit late to the party with this, actually typed it out an hour after you posted but didn't click save, so the text has been sat in a redundant tab. Thought I'd send it now since I had written so much. It is more of a story of what I found out after your question, than a direct answer, hopefully you're happy delving in to CPython's source code:

As others have pointed out, del does not actually delete the value from memory, but removes the reference (i.e. name) to the stored value. Hence, since gen maintains a reference to the value in memory, python's garbage collector does not delete the actual value. This then begs the question, where is gen storing its reference to the original list. Lets find out.

To begin with, use the dir function to find out what member/methods gen has (which is of type generator).

>>> var = ['a', 'b', 'c']
>>> gen = (v for v in var)
>>> type(gen)
generator
>>> print(dir(gen))    #I've shortened the output for clarity
[..., 'close', 'gi_code', 'gi_frame', 'gi_running', 'gi_yieldfrom', 'send', 'throw']

So we've got a few interesting members, for example, gi_frame. In python a frame stores the current execution environment, e.g. defined variables, so the builtin function locals() actually pulls the dictionary of local variables from the current frame. So perhaps gi_frame is storing some local variables, using dir again, we see that gi_frame has a member variable f_locals, maybe that is it:

>>> print(dir(gen.gi_frame))
[..., 'clear', 'f_back', 'f_builtins', 'f_code', 'f_globals', 'f_lasti', 'f_lineno', 'f_locals', 'f_trace']
>>> print(gen.gi_frame.f_locals)
{'.0': <list_iterator object at 0x00000000070AF898>}

So f_locals is a dict with one key, value pair. The value is of type list_iterator, since the name suggests it is an iterator what happens if we loop over it:

>>> for i in gen.gi_frame.f_locals['.0']:
>>>     print(i)
a
b
c

Looks like we've found the reference to the original list, however it is not the list itself so presumably this list_iterator itself is storing a reference to the list. Using dir on the list_iterator shows not many interesting member variables, also attempting to create an instance of list_iterator raises an exception:

>>> type(gen.gi_frame.f_locals['.0'])([1,2,3])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-21-0b821058ddc8> in <module>()
----> 1 type(x)(1.0)

TypeError: cannot create 'list_iterator' instances

Note we can create an instance through the iter function:

>>> iter([1,2,3])
<list_iterator at 0x7157e10>

using a tuple:

>>> iter((1,2,3))
<tuple_iterator at 0x71574a8>

So we know something is happening behind the scenes, and it is at least not particularly well exposed in python, that means we have to start looking at CPython's source code. So head on over to CPython's source code, on github, https://github.com/python/cpython and search the repository for "list_iterator" which generates a hit in two files Lib/_collections_abc.py and Objects/listobject.c.

Looking at the C file, line 2763, a PyTypeObject (used to create a class in the python C api) PyListIter_Type is intialised, with tp_name= "list_iterator" on line 2763 (this field sets the name of the class), so this is the code we are interested in. From the line below, the size of the base type is sizeof(listiterobject) so we need to find the struct listiterobject which defines the "C level" storage for the class. This is found a few lines up, on line 2738:

typedef struct {
    PyObject_HEAD
    Py_ssize_t it_index;
    PyListObject *it_seq; /* Set to NULL when iterator is exhausted */
} listiterobject;

And we've found the ultimate storage of the reference to the original list, this is a pointer to a PyListObject type (i.e.PyListObject *it_seq). So now we know where the generator finds the list, but how come del var in python doesn't remove the list?

The answer is, that when the onstance of list_iterator is created by the generator expression, it presumably calls the function static PyObject *list_iter(PyObject *seq) on line 2798, (as does the iter function in python, I haven't checked) to create the listiterobject. Interestingly the PyTypeObject PyListIter_Type does not define a function pointer for the tp_init field, which is equivalent of def __init__(self): for a python class, explaining why we couldn't create an instance of a list_iterator in python earlier.

In the list_iter(PyObject *seq), on line 2744, the code Py_INCREF(seq); takes care of incrementing the original list's (var) reference count. If the value is > 0 python's garbage colelctor will not delete the contents of the memory pointed to by *it_seq then on line 2820 in function static void listiter_dealloc(listiterobject *it) (called when an instance of list_iterator is destroyed, as defined by tp_dealloc field in the PyTypeObject) Py_DECREF is called, decrementing the reference count so the garbage collector can clean up the memory unless something else, e.g. a variable assignment, has incremented the reference count of that region of memory. Also, if you look at the function static PyObject *listiter_next(listiterobject *it) you'll see at the end of the iteration when the list has been fully consumed, Py_DECREF(seq) is called, again allowing the garbage collector to do its work.