takua624 / misc_tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A miscellaneous collection of random tools

color_conversion.py

  • Should be run in a terminal
  • Converts between RGB, HSV, and HSL
  • For RGB, you can either enter R, G, B values separately as 3 different arguments, or enter a single hexademical "#rrggbb" string
  • When the output is RGB, R, G, B values and the hexademical strings are output
  • When the output is HSV or HSL, H, S, V(L) values were output as a tuple

subj_name_code_decode.py

  • Should be run in a terminal
  • In name_code(), enter whatever character string you'd like to encode, and get a mysterious string of digits
  • In name_decode(), enter a mysterious string of digits, preceded by a pound sign and a space to find out the original character string it stands for.
  • If you try to decode a random digit string which is not generated by this name_code(), it can be done, but you're very likely to get mojibake
  • The mapping from character strings to mysterious digit strings is one-to-many

gen_logic_statements.py

  • Should be run in a terminal
  • Generates all possible if-then logical statements with three variables, two of which are joined by the AND operator or the OR operator. E.g., "If X then both Y and Z"
  • You can decide the names of the variables. They can be "X, Y, Z", "A, B, C", or even "El, Psy, Congroo", whatever you like!
  • The results are saved in an Excel spreadsheet.
  • Each statement comes with its valid inference ... or the logically equivalent statement derived from modus tollens reasoning and de Morgan's law. In the spreadsheet, the original statements are in the "prompt" column, and the valid inferences are in the "same" column

save_gii.py

  • Usually used as imported functions in other scripts (e.g., from save_gii import extract_gii)
  • extract_gii() extracts a .gii surfaced-based functional MRI image as a numpy array with the shape of (32492,1)
  • save_gii() saves a (32492,1) numpy array into a .gii image
  • There may be functions in the nibabel module that do these tasks, but I can't find them. In nibabel, there are easy read and write functions for volume-based .nii files, but it doesn't seem so for .gii files

About


Languages

Language:Python 100.0%