This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mupif as mp | |
import tqdm | |
# schemata must be passed at string to HeavyStruct constructor | |
# they are only needed when creating the container for the first time | |
# any subsequent access uses schemata stored in the container itself | |
schemata=open('schemata.json').read() | |
# schemaName specifies the top-level schema | |
# to create molecule-only container, say schemaName='gr.uoi.kostis.molecule', as in the second example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send a single IR NEC-encoded frabe over IR using 3 different libs | |
// #define LIB_IRREMOTE | |
// #define LIB_IRLIB2 | |
#define LIB_IR4A | |
const byte IR_CMD=0xe0; | |
const byte IR_DEV = 0x00; | |
// frame structure: devId, 0xff-devId, cmd, 0xff-cmd | |
union Frame { uint32_t data; byte b[4]; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<vector> | |
#include<type_traits> | |
#include<Eigen/Eigen> | |
#include<xtensor/xtensor.hpp> | |
#include<xtensor/xarray.hpp> | |
#include<iostream> | |
using std::cerr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<H5cpp.h> | |
#include<sys/file.h> | |
#include<iostream> | |
/* With libhdf5 1.10, file gets locked but the lock is not removed at close. | |
Thus opening the file from the same process will fail. | |
This function will force unlock before the file is closed. | |
3 things must be done, in this order: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<Eigen/Core> | |
#include<iostream> | |
#include<numeric> | |
// based on and verified with https://stackoverflow.com/a/46262628/761090 | |
// works for size 11 with int and 15 with long int (on amd64) | |
template<typename Int> | |
std::tuple<Eigen::Matrix<Int,Eigen::Dynamic,Eigen::Dynamic>,Int> sobelGradFilterX_int(int sz){ | |
assert(sz>0); |