Thursday, February 17, 2022

Paraview Convert VTK file to PLY using Paraview script

 

1. vtk2ply 


from paraview.simple import *

import sys

pFrame30vtk = LegacyVTKReader(FileNames=[sys.argv[1]])

SaveData(sys.argv[2], proxy=pFrame30vtk)

Friday, November 26, 2021

Sunday, November 21, 2021

Rip current detection

 

[1] Correntes de retorno https://www.youtube.com/watch?v=yKvDOzvjApE

[2] Rip Current  https://www.youtube.com/watch?v=RJ4hcaJ91TY

[3] Paper 2021 https://arxiv.org/pdf/2102.02902.pdf

 

Tuesday, November 16, 2021

3D grid savig methods using struct.pack

 

Python version for ints
def save2grid(filename,volume,dimx,dimy,dimz):

  with open(filename, "wb") as file:
    for i in range(dimx):
      for j in range(dimy):
        for k in range(dimz):
          f = (volume[i][j][k]*255).astype(np.uint8) #numpy.uint8
          #print(type(f))
          b = struct.pack('B', f)  #was f
          file.write(b)
          
def save2gridfast(filename,volume,dimx,dimy,dimz):
  flat=volume.reshape((dimx*dimy*dimz))
  flat=(flat*255).astype(np.uint8)
  with open(filename, "wb") as file:
       b = struct.pack('%sB' % len(flat), *flat)
       file.write(b) 

Python version for floats

def save2grid(filename,volume,dimx,dimy,dimz):

  with open(filename, "wb") as file:
    for i in range(dimx):
      for j in range(dimy):
        for k in range(dimz):
          f = volume[i][j][k] #[3.14, 2.7, 0.0, -1.0, 1.1]
          b = struct.pack('f', f)
          file.write(b)
def save2grid2(filename,volume,dimx,dimy,dimz):
  flat=volume.reshape((dimx*dimy*dimz))
  with open(filename, "wb") as file:
    for i in range(dimx*dimy*dimz):
       f = flat[i]
       b = struct.pack('f', f)
       file.write(b)
def save2grid3(filename,volume,dimx,dimy,dimz):
  flat=volume.reshape((dimx*dimy*dimz))
  with open(filename, "wb") as file:
       b = struct.pack('%sf' % len(flat), *flat)
       #b = struct.pack('f', f)
       file.write(b)

Update Chrome in Ubuntu

 


# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update 
sudo apt-get install google-chrome-stable


# Update

sudo apt-get --only-upgrade install google-chrome-stable

Sunday, November 14, 2021

Time series forecasting

To review

 

[1] https://machinelearningmastery.com/how-to-develop-lstm-models-for-time-series-forecasting/

[2] https://www.tensorflow.org/tutorials/structured_data/time_series

[3] https://analyticsindiamag.com/tutorial-on-univariate-single-step-style-lstm-in-time-series-forecasting/

[4] https://towardsdatascience.com/multivariate-time-series-forecasting-with-transformers-384dc6ce989b

 

 

Friday, October 29, 2021

Houdini 18 - Changing temp directory

 

Setting temp directory

$ locate houdini.env

/home/cloud/houdini18.0/houdini.env

#
# Houdini Environment Settings
#
# The contents of this file are read into the environment
# at startup.  They will override any existing entries in
# the environment.
#
# The syntax is one entry per line as follows:
#    VAR = VALUE
#
# Values may be quoted
#    VAR = "VALUE"
#
# Values may be empty
#    VAR =  
#

# Example:
#
# HOUDINI_NO_SPLASH = 1


HOUDINI_TEMP_DIR = /home/cloud/.houdinitmp

 

 

Wednesday, October 27, 2021

DualSPHysics Simulation pipeline

 

First Step: Create geometry

[1] FreeCAD https://www.freecadweb.org/downloads.php

[2] Plugin DesignSPHysics https://github.com/DualSPHysics/DesignSPHysics

Second Step: Compile/Install DualSPHysics

[1] How to https://melhorum.blogspot.com/2019/07/dualsphysics.html

Third Step: Run smulation CPU or GPU

[1] ...

Fourth Step: Polygonize/Render

[1] ...

 

 

Tuesday, October 26, 2021

Video tools online

Rotate/Crop/Resize

[1] https://ezgif.com/rotate-video

[2] Fast https://www.rotatevideo.org/ 


Thursday, October 21, 2021

Linux check input ports

 $ sudo cat /proc/ioports

0000-0cf7 : PCI Bus 0000:00
 0000-001f : dma1
 0020-0021 : pic1
 0040-0043 : timer0
 0050-0053 : timer1
 0060-0060 : keyboard
 0061-0061 : PNP0800:00
 0064-0064 : keyboard
 0070-0071 : rtc0
 0080-008f : dma page reg
 00a0-00a1 : pic2
 00c0-00df : dma2
 00f0-00ff : PNP0C04:00
   00f0-00ff : fpu
 0290-0297 : pnp 00:03
 0378-037a : parport0
 037b-037f : parport0
 03c0-03df : vesafb
 03f8-03ff : serial
 0400-041f : 0000:00:1f.3
 04d0-04d1 : pnp 00:04
 0500-053f : 0000:00:1f.0
 0778-077a : parport0
 0800-087f : 0000:00:1f.0
   0800-087f : pnp 00:04
     0800-0803 : ACPI PM1a_EVT_BLK
     0804-0805 : ACPI PM1a_CNT_BLK
     0808-080b : ACPI PM_TMR
     0820-082f : ACPI GPE0_BLK
     0830-0833 : iTCO_wdt.0.auto
     0850-0850 : ACPI PM2_CNT_BLK
     0860-087f : iTCO_wdt.0.auto
0cf8-0cff : PCI conf1
0d00-ffff : PCI Bus 0000:00
 1000-1fff : PCI Bus 0000:05
 2000-2fff : PCI Bus 0000:04

$ cat /proc/bus/input/devices

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
U: Uniq=
H: Handlers=kbd event0  
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=LNXPWRBN/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
U: Uniq=
H: Handlers=kbd event1  
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0003 Vendor=046d Product=c016 Version=0110
N: Name="Logitech Optical USB Mouse"
P: Phys=usb-0000:00:1d.0-1/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.0/0003:046D:C016.0001/i
nput/input5
U: Uniq=
H: Handlers=mouse0 event2  
B: PROP=0
B: EV=17
B: KEY=70000 0 0 0 0
B: REL=103
B: MSC=10

I: Bus=0003 Vendor=045e Product=0750 Version=0111
N: Name="Microsoft Wired Keyboard 600"
P: Phys=usb-0000:00:1d.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.0/0003:045E:0750.0002/i
nput/input6
U: Uniq=
H: Handlers=sysrq kbd event3 leds  
B: PROP=0
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

I: Bus=0003 Vendor=045e Product=0750 Version=0111
N: Name="Microsoft Wired Keyboard 600"
P: Phys=usb-0000:00:1d.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb6/6-2/6-2:1.1/0003:045E:0750.0003/i
nput/input7
U: Uniq=
H: Handlers=sysrq kbd event4  
B: PROP=0
B: EV=10001f
B: KEY=3f0003007f 0 0 4c3ffff17aff32d bf54445600000000 1 130f938b17c007 ffff7bfa
d971dfff febeffdfffefffff fffffffffffffffe
B: REL=40
B: ABS=10100000000
B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA Intel Front Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1b.0/sound/card0/input8
U: Uniq=
H: Handlers=event5  
B: PROP=0
B: EV=21
B: SW=10


$sudo cat /dev/input/event3 #test if it's working



Saturday, October 16, 2021

Linux Touchpad issues

 

xinput list

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Dell Dell Universal Receiver              id=11   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS DualPoint TouchPad          id=16   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS DualPoint Stick             id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
   ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
   ↳ Power Button                              id=6    [slave  keyboard (3)]
   ↳ Video Bus                                 id=7    [slave  keyboard (3)]
   ↳ Power Button                              id=8    [slave  keyboard (3)]
   ↳ Sleep Button                              id=9    [slave  keyboard (3)]
   ↳ Dell Dell Universal Receiver              id=10   [slave  keyboard (3)]
   ↳ Laptop_Integrated_Webcam_HD: In           id=12   [slave  keyboard (3)]
   ↳ Dell WMI hotkeys                          id=13   [slave  keyboard (3)]
   ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]
   ↳ Dell Dell Universal Receiver              id=17   [slave  keyboard (3)]

xinput -list-props 16

 
Device 'AlpsPS/2 ALPS DualPoint TouchPad':
       Device Enabled (142):   1
       Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
       Device Accel Profile (275):     0
       Device Accel Constant Deceleration (276):       1.000000
       Device Accel Adaptive Deceleration (277):       1.000000
       Device Accel Velocity Scaling (278):    5.000000
       Trackpad Disable Input (305):   0
       Trackpad Sensitivity (306):     0.500000
       Trackpad Touch Pressure (307):  5, 5
       Trackpad Button Settings (308): 1, 1
       Trackpad Button Emulation Settings (309):       0, 1, 100
       Trackpad Button Emulation Values (310): 3, 2, 0
       Trackpad Tap Settings (311):    50, 120, 400
       Trackpad Tap Button Emulation (312):    1, 3, 2, 0
       Trackpad Thumb Detection (313): 0, 0
       Trackpad Thumb Size (314):      25, 70
       Trackpad Palm Detection (315):  0, 0
       Trackpad Palm Size (316):       40
       Trackpad Gesture Settings (317):        10, 100
       Trackpad Scroll Distance (318): 150
       Trackpad Scroll Buttons (319):  4, 5, 6, 7
       Trackpad Swipe Distance (320):  700
       Trackpad Swipe Buttons (321):   8, 9, 10, 11
       Trackpad Swipe4 Distance (322): 700
       Trackpad Swipe4 Buttons (323):  0, 0, 0, 0
       Trackpad Scale Distance (324):  150
       Trackpad Scale Buttons (325):   14, 15
       Trackpad Rotate Distance (326): 150
       Trackpad Drag Settings (327):   1, 350, 40, 200
       Trackpad Axis Inversion (328):  0, 0


xinput -set-prop 16 306 0.5

 

Tuesday, October 05, 2021

Processing mp3 by Python3 in Linux

 

 

$ sudo apt install llvm-8
 

$ locate llvm-config

$ LLVM_CONFIG=/usr/bin/llvm-config-8 pip3 install librosa --user
 

 

packages: llvmlite, numba, soundfile, resampy, audioread, librosa


 

Monday, September 20, 2021

Tuesday, August 31, 2021

Cryptocurrencies Resources

Where to Check

[1] Cryptocurrencies info (BR)  https://investidor10.com.br/criptomoedas/chiliz/

[2] Cryptocurrencies info https://coinmarketcap.com/

[3] https://panoramacrypto.com.br/

[4] Bitcoin https://www.lookintobitcoin.com

[5] Prediction chart https://www.lookintobitcoin.com/charts/stock-to-flow-model/

Where to buy

[1] Choose where to buy by country https://www.buybitcoinworldwide.com/

[2] Exchange in Brazil www.mercadobitcoin.com.br  

Where to Save

[1] Wallet MetaMask (Expensive to transfer in Wallet)

 

PerĆŗ

[1] https://fluyez.com/

[2] https://www.buda.com/


Whales

[1] https://www.whalestats.com/


Software

[1] ATANI Windows/MacOS/Linux https://atani.com/download

   
$ sudo apt update
$ sudo apt install snapd
$ sudo snap install core

$sudo snap install atani

 

 

 

 

 

 

 


Thursday, August 19, 2021

OpenGL in Cuda Study

Starting

[1] https://www.geeksforgeeks.org/getting-started-with-opengl/

 


1) http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

2) https://math.hws.edu/graphicsbook/c3/s4.html

 

 

Thursday, July 15, 2021

Spanish books

 [1] Calculo http://blog.espol.edu.ec/srpinarg/files/2014/05/Calculo-de-Purcell-9na-Edici%C3%B3n.pdf


Wednesday, July 14, 2021

English movie subtitles

 

Game of Thrones Blue Ray sub titles

https://australiapopulation.com/game-of-thrones-season-3-subtitles/

[2] Shifter https://subshifter.bitsnbites.eu/

Thursday, July 01, 2021

Images to PDF file (case study)

0. Previous requeriments

$sudo apt install img2pdf
$sudo apt install ocrmypdf

1. Download images by script

for n in `seq 1 23`
do
  sn=`printf "%02d" $n`
  echo $sn
  wget https://larepublica.cronosmedia.glr.pe/printed/2021/07/01/lima/pages/$sn.jpeg
done
 

2. Convert images to pdf (after executed download script by sh)

$img2pdf *.jpeg --output rep1.pdf #or

$convert *.jpeg rep2.pdf

$ocrmypdf rep1.pdf rep1_ocr.pdf #reduce size

 

Notes for convert command(change from none to read|write):

sudo vim /etc/ImageMagick-6/policy.xml

<policy domain="coder" rights="none" pattern="PDF" />

<policy domain="coder" rights="read|write" pattern="PDF" />
 
 
Bonus
[1] El Pueblo news url https://www.diarioelpueblo.com.pe/wp-content/uploads/2021/07/01-07-2021.pdf
 

Wednesday, June 30, 2021

Challenges

 

https://www.edx.org/course/high-dimensional-data-analysis

PostgreSQL json fields

select name->'es_PE',* from product_template where name->>'es_PE' like '%MEGACI%'   References: [1] https:/...