Skip to content

Instantly share code, notes, and snippets.

View yohanesnuwara's full-sized avatar
:octocat:

yohanesnuwara yohanesnuwara

:octocat:
View GitHub Profile
@yohanesnuwara
yohanesnuwara / marmousi_fatiando_scalar.ipynb
Created January 18, 2020 08:13 — forked from eusoubrasileiro/marmousi_fatiando_scalar.ipynb
Running scalar wave equation marmousi data set from madagascar.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yohanesnuwara
yohanesnuwara / TDMAsolver.py
Created March 7, 2020 06:48 — forked from cbellei/TDMAsolver.py
Tridiagonal Matrix Algorithm solver in Python
import numpy as np
## Tri Diagonal Matrix Algorithm(a.k.a Thomas algorithm) solver
def TDMAsolver(a, b, c, d):
'''
TDMA solver, a b c d can be NumPy array type or Python list type.
refer to http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
and to http://www.cfd-online.com/Wiki/Tridiagonal_matrix_algorithm_-_TDMA_(Thomas_algorithm)
'''
nf = len(d) # number of equations
def xplot(axisx, axisy, axisz):
plt.scatter(axisx, axisy, c=axisz, s=5, cmap='gist_rainbow')
plt.colorbar()
@yohanesnuwara
yohanesnuwara / nan_checker.py
Created March 24, 2020 05:54
Check and remove NaN values in DataFrame
import pandas as pd
# create dataframe from data
data = pd.DataFrame({"Column_1": numpy_1, "Column_2": numpy_2, "Column_3": numpy_3})
# print original size of data before NaN values removal
print("Original size of data:", len(data), "rows")
# look up the number of rows with NaN data
print("How many data with NaN values?")
print(data.isnull().sum())

Problem

A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:

$e^{i \pi} = -1$

Unfortunately, GitHub does not support inline formulas. The issue is tracked here.

Investigation

@yohanesnuwara
yohanesnuwara / tti_anisotropy.py
Last active January 25, 2024 00:15
Tensor rotation in Tilted Transverse Isotropy (TTI)
"""
Tensor rotation in Tilted Transverse Isotropy (TTI) for the 36 stiffness elements
Discussion which I started here: https://www.researchgate.net/post/How_to_do_coordinate_transformation_of_a_6x6_stiffness_matrix_of_tilted_transverse_isotropic_medium
@author: Yohanes Nuwara
@email: ign.nuwara97@gmail.com
Possible extension of this work (may need collaboration):
* Verify that the rotation is right by calculating its tensor invariants
* Test in real lab: Does the theoretically rotated tensor represent the true stiffness of the TTI rock?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yohanesnuwara
yohanesnuwara / Rdatasets.csv
Created January 4, 2021 03:30
Datasets stored in R packages
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 12 columns, instead of 8. in line 5.
"Package","Item","Title","Rows","Cols","n_binary","n_character","n_factor","n_logical","n_numeric","CSV","Doc"
"AER","Affairs","Fair's Extramarital Affairs Data",601,9,2,0,2,0,7,"https://vincentarelbundock.github.io/Rdatasets/csv/AER/Affairs.csv","https://vincentarelbundock.github.io/Rdatasets/doc/AER/Affairs.html"
"AER","ArgentinaCPI","Consumer Price Index in Argentina",80,2,0,0,0,0,2,"https://vincentarelbundock.github.io/Rdatasets/csv/AER/ArgentinaCPI.csv","https://vincentarelbundock.github.io/Rdatasets/doc/AER/ArgentinaCPI.html"
"AER","BankWages","Bank Wages",474,4,2,0,3,0,1,"https://vincentarelbundock.github.io/Rdatasets/csv/AER/BankWages.csv","https://vincentarelbundock.github.io/Rdatasets/doc/AER/BankWages.html"
"AER","BenderlyZwick","Benderly and Zwick Data: Inflation, Growth and Stock Returns",31,5,0,0,0,0,5,"https://vincentarelbundock.github.io/Rdatasets/csv/AER/BenderlyZwick.csv","https://vincentarelbundock.github.io/Rdatasets/doc/AER/BenderlyZwick.html"
"AER","BondYield","Bond Yield Data",60,2,0,0,
@yohanesnuwara
yohanesnuwara / meteorite-landings.csv
Created April 15, 2021 16:23
Data for Pandas practice
We can't make this file beautiful and searchable because it's too large.
name,id,nametype,recclass,mass,fall,year,reclat,reclong,GeoLocation
Aachen,1,Valid,L5,21,Fell,1880,50.775000,6.083330,"(50.775000, 6.083330)"
Aarhus,2,Valid,H6,720,Fell,1951,56.183330,10.233330,"(56.183330, 10.233330)"
Abee,6,Valid,EH4,107000,Fell,1952,54.216670,-113.000000,"(54.216670, -113.000000)"
Acapulco,10,Valid,Acapulcoite,1914,Fell,1976,16.883330,-99.900000,"(16.883330, -99.900000)"
Achiras,370,Valid,L6,780,Fell,1902,-33.166670,-64.950000,"(-33.166670, -64.950000)"
Adhi Kot,379,Valid,EH4,4239,Fell,1919,32.100000,71.800000,"(32.100000, 71.800000)"
Adzhi-Bogdo (stone),390,Valid,LL3-6,910,Fell,1949,44.833330,95.166670,"(44.833330, 95.166670)"
Agen,392,Valid,H5,30000,Fell,1814,44.216670,0.616670,"(44.216670, 0.616670)"
Aguada,398,Valid,L6,1620,Fell,1930,-31.600000,-65.233330,"(-31.600000, -65.233330)"
@yohanesnuwara
yohanesnuwara / idm2.py
Created July 2, 2021 08:05
Calculate probability of neutron porosity from drilling torque
import statviz
# Choose lithology
lith = 'marl' # sandstone, claystone, marl
# Two variables to plot against
x, y = 'TORQUE', 'BPHI'
# Bounds of each variable to evaluate probabilities
xbound, ybound = (20e3, 22.5e3), (20, 30)