To be more clear, by the decay rate of a dampening function I mean fitting the exponential curve to the amplitude of the damped oscillations and see how it decays. Something like the following : Damped Sine wave but for my graph which is certainly not smooth like the above and whose picture I still cannot upl…
Tag: python
How can I add the following JSON to a new URL based on its “category”: 2?
I have a JSON array in my server in Django rest framework, but I want to filter them by category , for example some of them have ‘category’:1 and some of them have ‘category’:2 like this: How can I add the following JSON to a new URL based on its “category”: 2? views: urls:…
Regex match word not immediately preceded by another word but possibly preceded by that word before
I need to match all strings that contain one word of a list, but only if that word is not immediately preceded by another specific word. I have this regex: .*(?<!forbidden)b(word1|word2|word3)b.* that is still matching a sentence like hello forbidden word1 because forbidden is matched by .*. But if I remov…
How to make enumerate not count blank’s indexes?
I am trying to writing a function which will take a sentence and make each odd letter an uppercase one and each even letter a lowercase one. Here is what I tried: When the input is “Hello my guy”, the output is “HeLlO My gUy” and not “HeLlO mY gUy” because it counts blank a…
How can I run an ffmpeg command in a python script?
I want to overlay a transparent video over top of an image using ffmpeg and python I am able to do this successfully through terminal, but I cannot get ffmpeg commands to work in python. The following command produces the result that I want in terminal when I am in the directory with the files there. In pytho…
python how to combine two list (key/vaule pairs), which has list of dicts
I have two lists and each list has multiple items. here is the example: x: lst: desired output: new_list: i want to create a new key called “resource_allocation” and add “lst” item value to it, show above i am trying to do like this: got error: i am sure i am doing it wrong, can any on…
Python: will a thread ever unblock while hanging on a `Queue.get(block=True)` call if the queue is suddenly destroyed from another thread/process?
TLDR: Would a blocking get be unblocked by a queue that would be terminated in some way? Long question: Okay, so I know that the thread will hang if the queue (multiprocessing.Queue) remains empty forever while trying to fetch something from it with a blocking get. But suppose now that in another thread or pr…
Unable to load S3-hosted CSV into Spark Dataframe on Jupyter Notebook
Unable to load S3-hosted CSV into Spark Dataframe on Jupyter Notebook. I believe I uploaded the 2 required packages with the os.environ line below. If I did it incorrectly please show me how to correctly install it. The Jupyter Notebook is hosted on an EC2 instance, which is why I’m trying to pull the C…
Notification in django rest API
I want to make a notification system in django so that, when you add a new entry to the database I get notified. As admin I do everything in the Django Rest API Answer using signals.py, I sent a message to the bot via json
Synchronization for video/audio/text message in flask web app framework for facial emotion recognition
I have trained a CNN model in Google Colab for facial expression detection with the FER2013 dataset containing 7 emotion classes (‘Angry’, ‘Disgust’, ‘Fear’, ‘Happy’, ‘Sad’, ‘Surprise’, ‘Neutral’). Used flask framework to buil…