Skip to content

Instantly share code, notes, and snippets.

View dehaenw's full-sized avatar
🎯
havent even found the haystack yet

dehaenw

🎯
havent even found the haystack yet
  • Praha
View GitHub Profile
@dehaenw
dehaenw / never_go_from_inchi_to_mol.ipynb
Created October 5, 2023 12:16
Never go from inchi back to mol!!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import rdkit
from rdkit import Chem
from rdkit.Chem import ChemicalFeatures
from rdkit.Chem.Pharm2D.SigFactory import SigFactory
from rdkit.Chem.Pharm2D import Generate
from rdkit import RDConfig
import os
featFactory = ChemicalFeatures.BuildFeatureFactory(os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef'))
sigFactory = SigFactory(featFactory,minPointCount=2,maxPointCount=3,trianglePruneBins=False)
sigFactory.SetBins([(0,2),(2,5),(5,8)])
import itertools as it
import numpy as np
import midiutil
from midiutil.MidiFile import MIDIFile
#generates about half an h of modal fingerpicking tunes using a simple markov model
#change the seed with increments of about 100K to get a new one.
#lots of parameters to play around with but you can figure it out yourself.
@dehaenw
dehaenw / gen.py
Last active December 8, 2021 16:30
SSCP
import itertools as it
allsmi=[]
maxvalence=2
def cl_ratio(Cl,C):
return Cl*35.45/((C*12.011)+(Cl*35.453)+((C*2-Cl+2)*1.008)) #ratio of chlorine vs total MW
for chainlength in [10,11,12,13]:
combinations = (list(i) for i in it.product(list(range(maxvalence+1)),repeat=chainlength) if tuple(reversed(i)) >= tuple(i)) #filter out mirror image molecules
from scipy.io import wavfile
import scipy.io
from scipy.fft import fft, ifft
import numpy as np
"""
chord.wav should be a short sound, equivalent to carrier in vocoder
impulse.wav should be a quite sparse transient heavy sound, equivalent to modulator in vocoder
play with tsmear and asmear to tweak between vocoder and convolution like sound
"""
Tsmear = 1000