Tag: python

Uncategorized

vs code and ProxiLAB

trying SCRIPTIS but debugger is flaky so VS Code got the shot once again.

    error = ProxiLAB.Reader.ISO14443.SendTclCommand(0x00, 0x00, TxBuffer, RxBuffer)
    if (error[0]):
        print("Tcl: {0}".format(ProxiLAB.GetErrorInfo(error[0])))
        PopMsg += "Tcl: {0}".format(ProxiLAB.GetErrorInfo(error[0])) + "\n"
    else:
        print("Tcl response: " + ''.join(["0x%02X " % x for x in RxBuffer.value]))
        PopMsg +=  "Tcl response: " + ''.join(["0x%02X " % x for x in RxBuffer.value]) + "\n"

Tcl response: 0x6A 0x86

Uncategorized

keolabs ProxiLAB Quest

doing some #python tests GetCard SendCommand for ISO/IEC 14443 smartcards.

  • python run and trace in Quest software as well as RGPA software. disadvantage missing debugging comf
  • so moved to VS Code with python and Keolabs lib python file
  • searching for implementation file and possible dlls for c# integration
  • Poller0 PCD proximity coupling device and PICC
  • challenge is to set up full python setup outside of delivered Quest. API functions full details?
https://www.keolabs.com/products/services-accessories/nomad-tester

https://diglib.tugraz.at/download.php?id=5f588b91684cf&location=browse

https://github.com/scriptotek/pyrfidgeek/blob/61595be017fe56f1f668422c15bc50354274a310/rfidgeek/rfidgeek.py#L122

    def inventory_iso14443A(self):
        """
        By sending a 0xA0 command to the EVM module, the module will carry out
        the whole ISO14443 anti-collision procedure and return the tags found.
            >>> Req type A (0x26)
            <<< ATQA (0x04 0x00)
            >>> Select all (0x93, 0x20)
            <<< UID + BCC
        """
        response = self.issue_evm_command(cmd='A0')

        for itm in response:
            iba = bytearray.fromhex(itm)
            # Assume 4-byte UID + 1 byte Block Check Character (BCC)
            if len(iba) != 5:
                logger.warn('Encountered tag with UID of unknown length')
                continue
            if iba[0] ^ iba[1] ^ iba[2] ^ iba[3] ^ iba[4] != 0:
                logger.warn('BCC check failed for tag')
                continue
            uid = itm[:8]  # hex string, so each byte is two chars

            logger.debug('Found tag: %s (%s) ', uid, itm[8:])
            yield uid

            # See https://github.com/nfc-tools/libnfc/blob/master/examples/nfc-anticol.c
Uncategorized

Boston Housing Data Analysis

API
https://www.tensorflow.org/api_docs/python/tf/keras/datasets/boston_housing/load_data

Samples contain 13 attributes of houses at different locations around the Boston suburbs in the late 1970s. Targets are the median values of the houses at a location (in k$).

http://lib.stat.cmu.edu/datasets/boston

404×13 = 5252

y_train x_train 404 samples
y_test x_test 102 samples
x 13
y 1 target scalar

y_train, y_test: numpy arrays of shape (num_samples,) containing the target scalars. The targets are float scalars typically between 10 and 50 that represent the home prices in k$.

Uncategorized

tensorflow pipenv keras

https://github.com/flowxcode/deepflow
https://pipenv.pypa.io/en/latest/
https://pipenv.pypa.io/en/latest/install/

$ pipenv run python main.py

$ pipenv shell

https://stackoverflow.com/a/68673872/1650038

settings.json to pipvenv in home .local

"python.pythonPath": "${env:HOME}/.local/share/virtualenvs/deepflow-eho_wYiM/bin/python"

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            //"program": "/home/linx/.local/share/virtualenvs/deepflow-eho_wYiM/<program>",
        }
    ]
}

test x format

import tensorflow as tf
print("TensorFlow version:", tf.__version__)

Uncategorized

the path to neural networks on flask python

https://towardsdatascience.com/a-financial-neural-network-for-quants-45ec0aaef73c

conda init
conda config --set auto_activate_base false
pip install notebook
cd /your/project/root/directory/
jupyter notebook 

code left

c right

!! dont forget about requirements.txt

https://towardsdatascience.com/activation-functions-neural-networks-1cbd9f8d91d6

https://www.datacamp.com/community/tutorials/lstm-python-stock-market

Uncategorized

virtual env python

different projects, different requirements different envs:
create your virtual environment

python3 -m venv tutorial-env
python -m venv venv
$ . venv/bin/activate

https://docs.python.org/3/tutorial/venv.html

add it in your git repo, .gitignore

echo "venv" >> .gitignore
create requirements.txt:
pip freeze > requirements.txt
git add requirements.txt

https://medium.com/wealthy-bytes/the-easiest-way-to-use-a-python-virtual-environment-with-git-401e07c39cde

pip install -r requirements.txt

https://boscacci.medium.com/why-and-how-to-make-a-requirements-txt-f329c685181e

tia